parse.go 526 B

12345678910111213
  1. package allocation
  2. import (
  3. "github.com/opencost/opencost/core/pkg/autocomplete"
  4. allocationfilter "github.com/opencost/opencost/core/pkg/filter/allocation"
  5. "github.com/opencost/opencost/core/pkg/util/httputil"
  6. )
  7. // ParseRequest builds an autocomplete.Request from query parameters.
  8. func ParseRequest(qp httputil.QueryParams, opts autocomplete.ParseOptions) (*autocomplete.Request, error) {
  9. parser := allocationfilter.NewAllocationFilterParser()
  10. return autocomplete.ParseRequest(qp, opts, ValidateField, parser.Parse)
  11. }