Documentation ¶
Index ¶
- type Instance
- type InstanceReport
- func GetRdsDailyInstances(ctx context.Context, params RdsQueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)
- func GetRdsData(ctx context.Context, parsedParams RdsQueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)
- func GetRdsMonthlyInstances(ctx context.Context, params RdsQueryParams) (int, []InstanceReport, error)
- func GetRdsUnusedData(ctx context.Context, params RdsUnusedQueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)
- type RdsQueryParams
- type RdsUnusedQueryParams
- type ResponseCost
- type ResponseRdsDaily
- type ResponseRdsMonthly
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct { rds.InstanceBase Tags map[string]string `json:"tags"` Costs map[string]float64 `json:"costs"` Stats rds.Stats `json:"stats"` }
Instance contains the information of an RDS instance
type InstanceReport ¶
type InstanceReport struct { utils.ReportBase Instance Instance `json:"instance"` }
InstanceReport has all the information of an RDS instance report
func GetRdsDailyInstances ¶
func GetRdsDailyInstances(ctx context.Context, params RdsQueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)
GetRdsDailyInstances does an elastic request and returns an array of instances daily report based on query params
func GetRdsData ¶
func GetRdsData(ctx context.Context, parsedParams RdsQueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)
GetRdsData gets RDS monthly reports based on query params, if there isn't a monthly report, it calls getRdsDailyInstances
func GetRdsMonthlyInstances ¶
func GetRdsMonthlyInstances(ctx context.Context, params RdsQueryParams) (int, []InstanceReport, error)
GetRdsMonthlyInstances does an elastic request and returns an array of instances monthly report based on query params
func GetRdsUnusedData ¶
func GetRdsUnusedData(ctx context.Context, params RdsUnusedQueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)
GetRdsUnusedData gets RDS reports and parse them based on query params to have an array of unused instances
type RdsQueryParams ¶
RdsQueryParams will store the parsed query params
type RdsUnusedQueryParams ¶
type RdsUnusedQueryParams struct { AccountList []string IndexList []string Date time.Time Count int }
RdsUnusedQueryParams will store the parsed query params
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 ResponseRdsDaily ¶
type ResponseRdsDaily struct { Accounts struct { Buckets []struct { Dates struct { Buckets []struct { Time string `json:"key_as_string"` Instances struct { Hits struct { Hits []struct { Instance rds.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 RDS Daily instances
type ResponseRdsMonthly ¶
type ResponseRdsMonthly struct { Accounts struct { Buckets []struct { Instances struct { Hits struct { Hits []struct { Instance rds.InstanceReport `json:"_source"` } `json:"hits"` } `json:"hits"` } `json:"instances"` } `json:"buckets"` } `json:"accounts"` }
Structure that allow to parse ES response for RDS Monthly instances