aws_uptime

package
v1.7.1-addpagewrapp.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnPermutations

func ColumnPermutations(results []*Result) map[string][]string

ColumnPermutations uses the result set to create a list of columns and all of their possible values This is normally used to create table headers and the like

func Handler

func Handler(server *api.ApiServer, w http.ResponseWriter, r *http.Request)

Handler

func Register

func Register(mux *http.ServeMux, apiServer *api.ApiServer)

Register sets the local context and database paths to the values passed and then attaches the local handles to the url patterns supported by aws_costs api

func StandardCounters

func StandardCounters(ctx context.Context, q *awsu.Queries, resp *ApiResponse)

StandardCounters adds the standard counter data

func StandardDates

func StandardDates(response *ApiResponse, start time.Time, end time.Time, rangeEnd time.Time, interval dates.Interval)

Types

type ApiResponse

type ApiResponse struct {
	*response.Response

	Counters       *Counters              `json:"counters,omitempty"`
	Columns        map[string][]string    `json:"columns,omitempty"`
	ColumnOrdering []string               `json:"column_ordering,omitempty"`
	QueryFilters   map[string]interface{} `json:"query_filters,omitempty"`
	Result         []*Result              `json:"result"`
}

ApiResponse is the response object used and returned by the aws_costs api handler Based on response.Response struct as a common ground and then add additional fields to the struct that are used for this api

func NewResponse

func NewResponse() *ApiResponse

NewResponse returns a clean response object

type CountValues

type CountValues struct {
	Count int `json:"count"`
}

CountValues tracks a single counter value This is normally used to track the total of the data sets

type Counters

type Counters struct {
	Totals *CountValues `json:"totals"`
	This   *CountValues `json:"current"`
}

Counters captures multiple count values, in general we return the Total (so everyhing in the database) version and `This` - which is based on the current query result

type PossibleResults

PossibleResults is used to constrain the type of the value on the Common func and simply is interface for all the know result types

type Result

type Result struct {
	Average  interface{} `json:"average,omitempty"`
	Interval interface{} `json:"interval,omitempty"`
	Unit     string      `json:"unit,omitempty"`
}

Result is used instead of the variable versions encapsulated by PossibleResults in the ApiResponse struct This is to simplify the parsing on both the api and the consumer in front To be effective, any empty field is omited in the json Converted using `Common` func

func Common

func Common[T PossibleResults](results []T) (common []*Result)

Common func converts from the known aws cost structs to the common result type via json marshaling

func StandardQueryResults

func StandardQueryResults(ctx context.Context, q *awsu.Queries, req *request.Request, r *http.Request) (results []*Result, err error)

StandardQueryResults

Jump to

Keyboard shortcuts

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