From d4b56d41f2fd4327b995682ecafbf5ebdfdcc934 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Tue, 24 Mar 2020 13:52:47 -0400 Subject: [PATCH] Cross policy lists (#64) * Add CLI and release notes for cross policy entity lists --- doc/release-notes.md | 19 +++++++++++++++++++ go.mod | 8 ++++---- go.sum | 12 ++++++++++-- ziti/cmd/ziti/cmd/edge_controller/list.go | 10 ++++++++-- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index 61e0388d0..3d652f7ae 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -4,6 +4,7 @@ Ziti 0.13 includes the following: * Changes to make working with policies easier, including * New APIs to list existing role attributes used by edge routers, identities and services + * New APIs to list entities related by polices (such as listing edge routers available to a service via service edge router policies) ## Making Policies More User Friendly ### Listing Role Attributes in Use @@ -51,6 +52,24 @@ Example output: ] } +## Listing Entities Related by Policies +This adds operations to the `/services`, `/identities` and `/edge-routers` endpoints. + + * Endpoint: /edge-routers + * New operations + * Query related identities: GET /edge-routers//identities?filter= + * Query related services: GET /edge-routers//services?filter= + + * Endpoint: /identities + * New operations + * Query related edge routers: GET /identities//edge-routers?filter= + * Query related services: GET /identities//services?filter= + + * Endpoint: /services + * New operations + * Query related identities: GET /services//identities?filter= + * Query related edge routers: GET /services//edge-routers?filter= + # Release 0.12 ## Theme Ziti 0.12 includes the following: diff --git a/go.mod b/go.mod index c18b45bf1..b1ec43740 100644 --- a/go.mod +++ b/go.mod @@ -24,13 +24,13 @@ require ( github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 github.com/michaelquigley/pfxlog v0.0.0-20190813191113-2be43bd0dccc - github.com/netfoundry/ziti-edge v0.12.7 + github.com/netfoundry/ziti-edge v0.12.9 github.com/netfoundry/ziti-fabric v0.11.3 - github.com/netfoundry/ziti-foundation v0.8.0 - github.com/netfoundry/ziti-sdk-golang v0.11.4 + github.com/netfoundry/ziti-foundation v0.8.1 + github.com/netfoundry/ziti-sdk-golang v0.11.5 github.com/pborman/uuid v1.2.0 github.com/pkg/errors v0.8.1 - github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 + github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 github.com/rs/cors v1.7.0 github.com/russross/blackfriday v1.5.2 github.com/shirou/gopsutil v2.19.11+incompatible diff --git a/go.sum b/go.sum index 43cc86944..085fb9e57 100644 --- a/go.sum +++ b/go.sum @@ -146,6 +146,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e h1:txQltCyjXAqVVSZDArPEhUTg35hKwVIuXwtQo7eAMNQ= github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d h1:/WZQPMZNsjZ7IlCpsLGdQBINg5bxKQ1K1sh6awxLtkA= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jinzhu/gorm v1.9.11 h1:gaHGvE+UnWGlbWG4Y3FUwY1EcZ5n6S9WtqBA/uySMLE= github.com/jinzhu/gorm v1.9.11/go.mod h1:bu/pK8szGZ2puuErfU0RwyeNdsf3e6nCX/noXaVxkfw= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= @@ -222,14 +224,18 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/netfoundry/secretstream v0.1.1 h1:z6T7B5DuOtr9O+SmKaS9DzwOoGLYtgvyTzuPuR5FO7I= github.com/netfoundry/secretstream v0.1.1/go.mod h1:uasYkYSp0MmNSlKOWJ2sVzxPms8e58TS4ENq4yro86k= -github.com/netfoundry/ziti-edge v0.12.7 h1:ecioN4stlaFxmjrh9OZPAPavEiQrDBJdGFOSQLsMWY8= -github.com/netfoundry/ziti-edge v0.12.7/go.mod h1:B7S9OIjYVvrBHzwYxS12URAd1YWKMN8GEvR0IbZnQI0= +github.com/netfoundry/ziti-edge v0.12.9 h1:7m/zZ30/oG3Zt5mcv6vioeLRWPEwakKfmdNMdmnpnD4= +github.com/netfoundry/ziti-edge v0.12.9/go.mod h1:B7S9OIjYVvrBHzwYxS12URAd1YWKMN8GEvR0IbZnQI0= github.com/netfoundry/ziti-fabric v0.11.3 h1:lGuIW8Aqe4zhrSwRYf32wRQsHj+vQAtPkUXSIu27QG0= github.com/netfoundry/ziti-fabric v0.11.3/go.mod h1:sSwzbU8Y2Du7QroBHgXvfSONL+PB8NEsOS3+rRDDsgk= github.com/netfoundry/ziti-foundation v0.8.0 h1:Njf9DSFwiLaOLmmr7kAdNu5ggSbecOjiQ66BdS89bP4= github.com/netfoundry/ziti-foundation v0.8.0/go.mod h1:MK2ajCpS40MtiZFnMYjKIBDTQFDWwgqNq+RxypNjl9U= +github.com/netfoundry/ziti-foundation v0.8.1 h1:gB8N+ow4fFDxIJOkslfZ+opn2y2svWV0Un91SQZk2N4= +github.com/netfoundry/ziti-foundation v0.8.1/go.mod h1:EhrF0tVGajmQYeCEz7BOHFK5D4alnoQsRz0HHTjNuvE= github.com/netfoundry/ziti-sdk-golang v0.11.4 h1:Ry8RKjgjeKrY1v8BeFlA5TG3ZggDsDwqwk9aZKuCAbg= github.com/netfoundry/ziti-sdk-golang v0.11.4/go.mod h1:E6QrVy0SdM8kktgzDrhr1qg+1Qu8JXPmp0fpSoxzZuk= +github.com/netfoundry/ziti-sdk-golang v0.11.5 h1:F5RrwU5rqEOvRA6yzsmgqBpjoZWPu1ZEHR0M52+qtyY= +github.com/netfoundry/ziti-sdk-golang v0.11.5/go.mod h1:6QXo6LkfWcklGlND0WUHyCttcgaRce/VE0mvxkNYkuQ= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/oleiade/reflections v1.0.0 h1:0ir4pc6v8/PJ0yw5AEtMddfXpWBXg9cnG7SgSoJuCgY= github.com/oleiade/reflections v1.0.0/go.mod h1:RbATFBbKYkVdqmSFtx13Bb/tVhR0lgOBXunWTZKeL4w= @@ -270,6 +276,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 h1:dY6ETXrvDG7Sa4vE8ZQG4yqWg6UnOcbqTAahkV813vQ= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= diff --git a/ziti/cmd/ziti/cmd/edge_controller/list.go b/ziti/cmd/ziti/cmd/edge_controller/list.go index b9bffc5d1..3aed9371d 100644 --- a/ziti/cmd/ziti/cmd/edge_controller/list.go +++ b/ziti/cmd/ziti/cmd/edge_controller/list.go @@ -74,8 +74,10 @@ func newListCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Comma configTypeListRootCmd.AddCommand(newSubListCmdForEntityType("config-type", "configs", outputConfigs, newOptions())) edgeRouterListRootCmd := newEntityListRootCmd("edge-router") - edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-router", "edge-router-policies", outputEdgeRouterPolicies, newOptions())) - edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-router", "service-edge-router-polices", outputServiceEdgeRouterPolicies, newOptions())) + edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-routers", "edge-router-policies", outputEdgeRouterPolicies, newOptions())) + edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-routers", "service-edge-router-polices", outputServiceEdgeRouterPolicies, newOptions())) + edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-routers", "identities", outputIdentities, newOptions())) + edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-routers", "services", outputServices, newOptions())) edgeRouterPolicyListRootCmd := newEntityListRootCmd("edge-router-policy") edgeRouterPolicyListRootCmd.AddCommand(newSubListCmdForEntityType("edge-router-policies", "edge-routers", outputEdgeRouters, newOptions())) @@ -83,13 +85,17 @@ func newListCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Comma identityListRootCmd := newEntityListRootCmd("identity") identityListRootCmd.AddCommand(newSubListCmdForEntityType("identities", "edge-router-policies", outputEdgeRouterPolicies, newOptions())) + identityListRootCmd.AddCommand(newSubListCmdForEntityType("identities", "edge-routers", outputEdgeRouters, newOptions())) identityListRootCmd.AddCommand(newSubListCmdForEntityType("identities", "service-policies", outputServicePolicies, newOptions())) + identityListRootCmd.AddCommand(newSubListCmdForEntityType("identities", "services", outputServices, newOptions())) serviceListRootCmd := newEntityListRootCmd("service") serviceListRootCmd.AddCommand(newSubListCmdForEntityType("services", "configs", outputConfigs, newOptions())) serviceListRootCmd.AddCommand(newSubListCmdForEntityType("services", "service-policies", outputServicePolicies, newOptions())) serviceListRootCmd.AddCommand(newSubListCmdForEntityType("services", "service-edge-router-policies", outputServiceEdgeRouterPolicies, newOptions())) serviceListRootCmd.AddCommand(newSubListCmdForEntityType("services", "terminators", outputTerminators, newOptions())) + serviceListRootCmd.AddCommand(newSubListCmdForEntityType("services", "identities", outputIdentities, newOptions())) + serviceListRootCmd.AddCommand(newSubListCmdForEntityType("services", "edge-routers", outputEdgeRouters, newOptions())) serviceEdgeRouterPolicyListRootCmd := newEntityListRootCmd("service-edge-router-policy") serviceEdgeRouterPolicyListRootCmd.AddCommand(newSubListCmdForEntityType("service-edge-router-policies", "services", outputServices, newOptions()))