|
6 | 6 |
|
7 | 7 | metrics "github.com/armon/go-metrics"
|
8 | 8 | "github.com/hashicorp/consul/acl"
|
9 |
| - "github.com/hashicorp/consul/agent/consul/discoverychain" |
10 | 9 | "github.com/hashicorp/consul/agent/consul/state"
|
11 | 10 | "github.com/hashicorp/consul/agent/structs"
|
12 | 11 | memdb "github.com/hashicorp/go-memdb"
|
@@ -313,64 +312,3 @@ func (c *ConfigEntry) ResolveServiceConfig(args *structs.ServiceConfigRequest, r
|
313 | 312 | return nil
|
314 | 313 | })
|
315 | 314 | }
|
316 |
| - |
317 |
| -func (c *ConfigEntry) ReadDiscoveryChain(args *structs.DiscoveryChainRequest, reply *structs.DiscoveryChainResponse) error { |
318 |
| - if done, err := c.srv.forward("ConfigEntry.ReadDiscoveryChain", args, args, reply); done { |
319 |
| - return err |
320 |
| - } |
321 |
| - defer metrics.MeasureSince([]string{"config_entry", "read_discovery_chain"}, time.Now()) |
322 |
| - |
323 |
| - // Fetch the ACL token, if any. |
324 |
| - rule, err := c.srv.ResolveToken(args.Token) |
325 |
| - if err != nil { |
326 |
| - return err |
327 |
| - } |
328 |
| - if rule != nil && !rule.ServiceRead(args.Name) { |
329 |
| - return acl.ErrPermissionDenied |
330 |
| - } |
331 |
| - |
332 |
| - if args.Name == "" { |
333 |
| - return fmt.Errorf("Must provide service name") |
334 |
| - } |
335 |
| - |
336 |
| - evalDC := args.EvaluateInDatacenter |
337 |
| - if evalDC == "" { |
338 |
| - evalDC = c.srv.config.Datacenter |
339 |
| - } |
340 |
| - |
341 |
| - evalNS := args.EvaluateInNamespace |
342 |
| - if evalNS == "" { |
343 |
| - // TODO(namespaces) pull from something else? |
344 |
| - evalNS = "default" |
345 |
| - } |
346 |
| - |
347 |
| - return c.srv.blockingQuery( |
348 |
| - &args.QueryOptions, |
349 |
| - &reply.QueryMeta, |
350 |
| - func(ws memdb.WatchSet, state *state.Store) error { |
351 |
| - index, entries, err := state.ReadDiscoveryChainConfigEntries(ws, args.Name) |
352 |
| - if err != nil { |
353 |
| - return err |
354 |
| - } |
355 |
| - |
356 |
| - // Then we compile it into something useful. |
357 |
| - chain, err := discoverychain.Compile(discoverychain.CompileRequest{ |
358 |
| - ServiceName: args.Name, |
359 |
| - CurrentNamespace: evalNS, |
360 |
| - CurrentDatacenter: evalDC, |
361 |
| - OverrideMeshGateway: args.OverrideMeshGateway, |
362 |
| - OverrideProtocol: args.OverrideProtocol, |
363 |
| - OverrideConnectTimeout: args.OverrideConnectTimeout, |
364 |
| - Entries: entries, |
365 |
| - }) |
366 |
| - if err != nil { |
367 |
| - return err |
368 |
| - } |
369 |
| - |
370 |
| - reply.Index = index |
371 |
| - reply.ConfigEntries = entries |
372 |
| - reply.Chain = chain |
373 |
| - |
374 |
| - return nil |
375 |
| - }) |
376 |
| -} |
0 commit comments