http: add partition query param parsing

This commit is contained in:
Kyle Havlovitz 2021-07-14 12:07:38 -07:00
parent 1169df0878
commit 77a2f38677
4 changed files with 10 additions and 0 deletions

View File

@ -235,6 +235,9 @@ func (s *HTTPHandlers) CatalogNodes(resp http.ResponseWriter, req *http.Request)
// Setup the request // Setup the request
args := structs.DCSpecificRequest{} args := structs.DCSpecificRequest{}
s.parseSource(req, &args.Source) s.parseSource(req, &args.Source)
if err := parseEntMetaPartition(req, &args.EnterpriseMeta); err != nil {
return nil, err
}
args.NodeMetaFilters = s.parseMetaFilter(req) args.NodeMetaFilters = s.parseMetaFilter(req)
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done { if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
metrics.IncrCounterWithLabels([]string{"client", "rpc", "error", "catalog_nodes"}, 1, metrics.IncrCounterWithLabels([]string{"client", "rpc", "error", "catalog_nodes"}, 1,

View File

@ -73,3 +73,8 @@ func (s *HTTPHandlers) enterpriseHandler(next http.Handler) http.Handler {
func (s *HTTPHandlers) uiTemplateDataTransform(data map[string]interface{}) error { func (s *HTTPHandlers) uiTemplateDataTransform(data map[string]interface{}) error {
return nil return nil
} }
// parseEntMetaPartition is a noop for the enterprise implementation.
func parseEntMetaPartition(req *http.Request, meta *structs.EnterpriseMeta) error {
return nil
}

View File

@ -47,6 +47,7 @@ type CatalogService struct {
Checks HealthChecks Checks HealthChecks
ModifyIndex uint64 ModifyIndex uint64
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
Partition string `json:",omitempty"`
} }
type CatalogNode struct { type CatalogNode struct {

View File

@ -44,6 +44,7 @@ type HealthCheck struct {
ServiceTags []string ServiceTags []string
Type string Type string
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
Partition string `json:",omitempty"`
Definition HealthCheckDefinition Definition HealthCheckDefinition