Hello,
I’m trying to filter the list of service.
I want to only have the list of service I needs.
I think I do something wrong with the query go-bxpr but not sure what.
Here is my code, that don’t filter my list of services:
package main
import (
"fmt"
nomad "github.com/hashicorp/nomad/api"
// "github.com/davecgh/go-spew/spew"
)
func main() {
config := nomad.Config{
Address: "http://192.168.0.137:4646",
Region: "global",
}
client, _ := nomad.NewClient(&config)
opts := &nomad.QueryOptions{
AllowStale: false,
Filter: "Services.ServiceName contains my-service",
}
stubs, _, _ := client.Services().List(opts)
for _, stub := range stubs {
for _, service := range stub.Services {
fmt.Print(service.ServiceName + "\n")
}
}
}
Thank you for your help