From e97bc2bda775bd4e9c7d13266e437b2177ac9909 Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Wed, 14 Jul 2021 12:07:38 -0700 Subject: [PATCH] http: add partition query param parsing --- agent/catalog_endpoint.go | 3 +++ agent/http_oss.go | 5 +++++ api/catalog.go | 1 + api/health.go | 1 + 4 files changed, 10 insertions(+) diff --git a/agent/catalog_endpoint.go b/agent/catalog_endpoint.go index 9b26f9f4d..838dde313 100644 --- a/agent/catalog_endpoint.go +++ b/agent/catalog_endpoint.go @@ -235,6 +235,9 @@ func (s *HTTPHandlers) CatalogNodes(resp http.ResponseWriter, req *http.Request) // Setup the request args := structs.DCSpecificRequest{} s.parseSource(req, &args.Source) + if err := parseEntMetaPartition(req, &args.EnterpriseMeta); err != nil { + return nil, err + } args.NodeMetaFilters = s.parseMetaFilter(req) if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done { metrics.IncrCounterWithLabels([]string{"client", "rpc", "error", "catalog_nodes"}, 1, diff --git a/agent/http_oss.go b/agent/http_oss.go index 9eb46d90a..662240472 100644 --- a/agent/http_oss.go +++ b/agent/http_oss.go @@ -73,3 +73,8 @@ func (s *HTTPHandlers) enterpriseHandler(next http.Handler) http.Handler { func (s *HTTPHandlers) uiTemplateDataTransform(data map[string]interface{}) error { return nil } + +// parseEntMetaPartition is a noop for the enterprise implementation. +func parseEntMetaPartition(req *http.Request, meta *structs.EnterpriseMeta) error { + return nil +} diff --git a/api/catalog.go b/api/catalog.go index b8588d828..ee7487252 100644 --- a/api/catalog.go +++ b/api/catalog.go @@ -47,6 +47,7 @@ type CatalogService struct { Checks HealthChecks ModifyIndex uint64 Namespace string `json:",omitempty"` + Partition string `json:",omitempty"` } type CatalogNode struct { diff --git a/api/health.go b/api/health.go index 0a3fd8dd1..b94043857 100644 --- a/api/health.go +++ b/api/health.go @@ -44,6 +44,7 @@ type HealthCheck struct { ServiceTags []string Type string Namespace string `json:",omitempty"` + Partition string `json:",omitempty"` Definition HealthCheckDefinition