github_standards

package
v1.2.0-awscostswork.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListHandler added in v1.0.0

func ListHandler(w http.ResponseWriter, r *http.Request)

ListHandler is configure to handler the `listRoute` url requests and will report a GHSResponse.

  • Connects to sql db via `apiDbPath`
  • Gets result data dependant on the `archived` and `team` get parameters
  • Generates compliance counters for the data set and overall
  • Finds the run date of the report

Sample urls:

  • /v1/github-standards/
  • /v1/github-standards/?archived=false
  • /v1/github-standards/?archived=false&team=<team>

func Register

func Register(ctx context.Context, mux *http.ServeMux, dbPath string) (err error)

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

func SetCtx added in v1.0.0

func SetCtx(ctx context.Context)

func SetDBPath added in v1.0.0

func SetDBPath(path string)

Types

type CountValues added in v1.0.0

type CountValues struct {
	Count             int `json:"count"`
	CompliantBaseline int `json:"compliant_baseline"`
	CompliantExtended int `json:"compliant_extended"`
}

CountValues covers the counters we want to return for the github standards data

type Counters added in v1.0.0

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

Counters covers Total and This data where Total is for the overal database and This is for the current query

type GHSResponse added in v1.0.0

type GHSResponse struct {
	*apiresponse.Response
	Counters     *Counters            `json:"counters,omitempty"`
	QueryFilters map[string]string    `json:"query_filters,omitempty"`
	Result       []ghs.GithubStandard `json:"result"`
}

GHSResponse uses base response and adds additional data to capture counters, passed query filters and the result data

func NewResponse added in v1.0.0

func NewResponse() *GHSResponse

Jump to

Keyboard shortcuts

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