Skip to content

Commit

Permalink
Merge pull request #814 from openziti/release-next
Browse files Browse the repository at this point in the history
Release Ziti v0.26.4
  • Loading branch information
plorenz authored Aug 9, 2022
2 parents f4124e2 + d96bd4d commit 75c96ba
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 60 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
# Release 0.26.4

## What's New

- Edge
- N/A
- Fabric
- Bug Fixes
- Ziti CLI
- `ziti fabric inspect` can now emit results to individual files using the `-f` flag
- SDK Golang
- N/A

## Fabric
### Bug Fixes

* [Issue 463](https://github.com/openziti/fabric/issues/463): fix for panic when dial service with instanceId and service has terminators but non for requested instanceId

# Release 0.26.3

## What's New
-

- Edge
- N/A
- Fabric
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ There are various levels of accessibility a network application/service can have

Making something dark can be done in a few ways, but the way it's generally handled in Ziti is that services reach out and establish one or more connections to the Ziti network fabric. Clients coming into the fabric can then reach the service through these connections after being authenticated and authorized.

Ziti routers, which make up the fabric, can also be dark. Routers locoated in private networks will usually be made dark. These routers will reach out of the private network to talk to the controller and to make connections to join the network fabric mesh. This allows the services and routers in your private networks to make only outbound connections, so no holes have to opened for inbound traffic.
Ziti routers, which make up the fabric, can also be dark. Routers located in private networks will usually be made dark. These routers will reach out of the private network to talk to the controller and to make connections to join the network fabric mesh. This allows the services and routers in your private networks to make only outbound connections, so no holes have to opened for inbound traffic.

Services can be completely dark if they are implemented with a Ziti SDK. If this is not possible a Ziti tunneler or proxy can be colocated with the service. The service then only needs to allow connections from the local machine or network, depending on how close you colocate the proxy to the service.

Expand Down
26 changes: 13 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ require (
github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19
github.com/michaelquigley/pfxlog v0.6.9
github.com/openziti/agent v1.0.1
github.com/openziti/channel v0.18.57
github.com/openziti/edge v0.22.36
github.com/openziti/fabric v0.19.28
github.com/openziti/foundation/v2 v2.0.1
github.com/openziti/channel v0.18.58
github.com/openziti/edge v0.22.54
github.com/openziti/fabric v0.19.34
github.com/openziti/foundation/v2 v2.0.2
github.com/openziti/identity v1.0.5
github.com/openziti/metrics v1.0.2
github.com/openziti/sdk-golang v0.16.102
github.com/openziti/storage v0.1.14
github.com/openziti/transport/v2 v2.0.19
github.com/openziti/metrics v1.0.3
github.com/openziti/sdk-golang v0.16.104
github.com/openziti/storage v0.1.16
github.com/openziti/transport/v2 v2.0.20
github.com/openziti/xweb/v2 v2.0.2
github.com/openziti/ziti-db-explorer v1.1.1
github.com/pborman/uuid v1.2.0
Expand All @@ -48,7 +48,7 @@ require (
go.etcd.io/bbolt v1.3.6
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
google.golang.org/grpc v1.42.0
google.golang.org/protobuf v1.28.0
google.golang.org/protobuf v1.28.1
gopkg.in/AlecAivazis/survey.v1 v1.8.7
gopkg.in/resty.v1 v1.12.0
gopkg.in/yaml.v2 v2.4.0
Expand Down Expand Up @@ -94,7 +94,7 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/hashicorp/go-hclog v1.2.1 // indirect
github.com/hashicorp/go-hclog v1.2.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
Expand Down Expand Up @@ -157,12 +157,12 @@ require (
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.mongodb.org/mongo-driver v1.10.0 // indirect
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/image v0.0.0-20191206065243-da761ea9ff43 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
Expand Down
50 changes: 26 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw=
github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-hclog v1.2.2 h1:ihRI7YFwcZdiSD7SIenIhHfQH3OuDvWerAUBZbeQS3M=
github.com/hashicorp/go-hclog v1.2.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
Expand Down Expand Up @@ -667,28 +667,28 @@ github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTm
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
github.com/openziti/agent v1.0.1 h1:mk3M6MOyK75Qc+lOdtKHywfaxnbSES9qi4NiLZQxOMU=
github.com/openziti/agent v1.0.1/go.mod h1:ALOg74f4b4GpUOjDPusp6lezbQa/7rgo09HOrodDWAw=
github.com/openziti/channel v0.18.57 h1:6Kp0kDMr18Ra2FZ+XR+GjmdOaGoP2NghgI8x0oWvXhs=
github.com/openziti/channel v0.18.57/go.mod h1:Q5iXnIvs9nWoCcx+S+yQ9BPiAhnRshbVP8zoKviztOw=
github.com/openziti/channel v0.18.58 h1:kTJGaH9/b6bvQnpEjaFFkBSJYvmWVLXuMk4foUucmrw=
github.com/openziti/channel v0.18.58/go.mod h1:2VK/VwFpre30GIPfzd0cPBXN5GmyKaiBJGHdpKcxiDo=
github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k=
github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo=
github.com/openziti/edge v0.22.36 h1:gjvIF06bpHFVIGZsKqz0XhrYwZyi9UmYxEeP33cdWF4=
github.com/openziti/edge v0.22.36/go.mod h1:C/TyZQa61oJDg7JFAFm/Lzfq8FlT7PYxxqA7oGtmD+8=
github.com/openziti/fabric v0.19.28 h1:uBh4VeaMEvgm3JMDuLPvg9kq1Am6csXECvbrvrJaxxo=
github.com/openziti/fabric v0.19.28/go.mod h1:8zgOd4JZGtC+tgscMPJV2WBQLVHLtMZZUAHvfs5eNyk=
github.com/openziti/foundation/v2 v2.0.1 h1:HKYwAyxlZ4zmlt0t9Y/v6SWso0qUaeWapkWOlQDKPEk=
github.com/openziti/foundation/v2 v2.0.1/go.mod h1:L75kwCC5WTUPqxuAd3G+WMBompaElMb/nYlJjR1sJ9Q=
github.com/openziti/edge v0.22.54 h1:pIYjQXRCRcauaCrG6dfTHLzq5enWyNUU0ipgWc0dbGg=
github.com/openziti/edge v0.22.54/go.mod h1:NfOFVCDHhirhEJafRA1whtv75AoZhNMoSZaI8tt/nzY=
github.com/openziti/fabric v0.19.34 h1:9snntZVLgPzYh8TJ7sjBJX842j9sDj80Dj21+sdJgr0=
github.com/openziti/fabric v0.19.34/go.mod h1:iXp11WpMTNoSUmLgGD+h23+ABOtAotPJp9GnN4GTKrM=
github.com/openziti/foundation/v2 v2.0.2 h1:mRmBgVSMLmySpORIbCEuFEH+8AUKasAnSAH5HLMKFEM=
github.com/openziti/foundation/v2 v2.0.2/go.mod h1:L75kwCC5WTUPqxuAd3G+WMBompaElMb/nYlJjR1sJ9Q=
github.com/openziti/identity v1.0.5 h1:PKW1tj0ctOWgscL3P4gKiVFfKrP6dYeP0U6R8Aw6DKM=
github.com/openziti/identity v1.0.5/go.mod h1:Nxf0CPFPkvdtFGvvsP4I/eZ//flU0q+sJVnLZDzlFOE=
github.com/openziti/jwks v1.0.1 h1:+BtBzDWFVUlJfCbBhQR0BZI3YNtoBvfhfdCUSSB0G+0=
github.com/openziti/jwks v1.0.1/go.mod h1:KwO0x9FBG0aoJS5f6nH5xeHoplyR1H143SMI9kF0mC8=
github.com/openziti/metrics v1.0.2 h1:X3ip93aDDgVeyhqxBLVwCtdG7/kILktFxcpl5N2+4+E=
github.com/openziti/metrics v1.0.2/go.mod h1:30EzUXm/VJfTVNoqPLx4x3mC/eslpCeh6wc4ejbZR/g=
github.com/openziti/sdk-golang v0.16.102 h1:buGFvgBAc2dO/9rJyh42ZYktUkW2JZ+ZvK5a3csBKeA=
github.com/openziti/sdk-golang v0.16.102/go.mod h1:GJtNmV3ZzJRGMgwXqu0FtNuHpMOENz1qd7+VYtytRz4=
github.com/openziti/storage v0.1.14 h1:JZv9OP0O4d3Z5c+ebaVpNUDJWrRsqgpTPHIwdCgYud0=
github.com/openziti/storage v0.1.14/go.mod h1:PXc1iYT8m+EmZf9EGyRTFwAToY1/jd5cAV2FFxL2D/g=
github.com/openziti/transport/v2 v2.0.19 h1:1pwj8uM1oHaabYOBJEcfqmUnkJWcsJUZ49+zOgUQzcY=
github.com/openziti/transport/v2 v2.0.19/go.mod h1:GgO7xeiT8pBxncGx/8wtz8XSelfpCGBC5pcG0FTGqcw=
github.com/openziti/metrics v1.0.3 h1:eS+DPbD1lfXOcFZWRuLz9Hhw+r5LgMwdczw4kXY+C/g=
github.com/openziti/metrics v1.0.3/go.mod h1:SeALokb6OJrCRwqX8U8EpnXDQBe/OkMuQLlU5zgOadQ=
github.com/openziti/sdk-golang v0.16.104 h1:JAu9JcLLx2BcO1a+XgN/l9TOv7XqaZdw1JLfaOgrF0s=
github.com/openziti/sdk-golang v0.16.104/go.mod h1:pZDIzgQMDRZXKBNjjRLLLafSZiDbi1V1TcVH2H/qBlk=
github.com/openziti/storage v0.1.16 h1:fROrbVVJCzV75DdXDwXqtLj2W9BdbpwLOb82rhcOUPA=
github.com/openziti/storage v0.1.16/go.mod h1:g7oNH2pyQY7xGy8UnnH+7XDTHrHSpnZfLlfvqxGdcxc=
github.com/openziti/transport/v2 v2.0.20 h1:5qn+d7qTb0KpjdHRac7yWmvaQ8wsKdm7SJOnwkXLAPY=
github.com/openziti/transport/v2 v2.0.20/go.mod h1:9ZzJLGjaAgG4mOzrUhk2YLRisl3JIDNCjCEWU+JcS5o=
github.com/openziti/x509-claims v1.0.2 h1:PSv/xRfejIAcPc16A902k08rSBs3R8bjtL4qq6WEwCI=
github.com/openziti/x509-claims v1.0.2/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE=
github.com/openziti/xweb/v2 v2.0.2 h1:XYlVFriTq/U1wcUrc+XPnWJGhXh9NJPhtQ7+r3aC0cU=
Expand Down Expand Up @@ -970,8 +970,9 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -1183,13 +1184,14 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 h1:v1W7bwXHsnLLloWYTVEdvGvA7BHMeBYsPcF0GLDxIRs=
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM=
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -1396,8 +1398,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/AlecAivazis/survey.v1 v1.8.7 h1:oBJqtgsyBLg9K5FK9twNUbcPnbCPoh+R9a+7nag3qJM=
gopkg.in/AlecAivazis/survey.v1 v1.8.7/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
Expand Down
94 changes: 74 additions & 20 deletions ziti/cmd/ziti/cmd/fabric/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import (
"fmt"
"github.com/openziti/fabric/rest_client/inspect"
"github.com/openziti/fabric/rest_model"
"github.com/openziti/foundation/v2/errorz"
"github.com/openziti/foundation/v2/stringz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/spf13/cobra"
"io"
"os"
"sort"
"strings"
)
Expand All @@ -22,17 +25,18 @@ func newInspectCmd(p common.OptionsProvider) *cobra.Command {

type InspectCmd struct {
api.Options
prettyPrint bool
toFiles bool
}

func (self *InspectCmd) newCobraCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "inspect",
Short: "Inspect runtime application values",
Short: "Inspect runtime <application> <values>",
RunE: self.run,
Args: cobra.MinimumNArgs(2),
}
self.AddCommonFlags(cmd)
cmd.Flags().BoolVarP(&self.toFiles, "file", "f", false, "Output results to a file per result, with the format <instanceId>.<ValueName>")
return cmd
}

Expand Down Expand Up @@ -60,11 +64,34 @@ func (self *InspectCmd) run(_ *cobra.Command, args []string) error {

result := inspectOk.Payload
if *result.Success {
fmt.Printf("\nResults: (%d)\n", len(result.Values))
fmt.Printf("Results: (%d)\n", len(result.Values))
for _, value := range result.Values {
fmt.Printf("%v.%v\n", stringz.OrEmpty(value.AppID), stringz.OrEmpty(value.Name))
self.prettyPrintOutput(value.Value, 0)
fmt.Printf("\n")
appId := stringz.OrEmpty(value.AppID)
name := stringz.OrEmpty(value.Name)
var out io.Writer
var file *os.File
if self.toFiles {
fmt.Printf("output result to: %v.%v\n", appId, name)
file, err = os.Create(fmt.Sprintf("%v.%v", appId, name))
if err != nil {
return err
}
out = file
} else {
fmt.Printf("%v.%v\n", appId, name)
out = os.Stdout
}
if err = self.prettyPrintOutput(out, value.Value, 0); err != nil {
if closeErr := file.Close(); closeErr != nil {
return errorz.MultipleErrors{err, closeErr}
}
return err
}
if file != nil {
if err = file.Close(); err != nil {
return err
}
}
}
} else {
fmt.Printf("\nEncountered errors: (%d)\n", len(result.Errors))
Expand All @@ -76,44 +103,71 @@ func (self *InspectCmd) run(_ *cobra.Command, args []string) error {
return nil
}

func (self *InspectCmd) prettyPrintOutput(val interface{}, indent int) {
func (self *InspectCmd) prettyPrintOutput(o io.Writer, val interface{}, indent int) error {
if mapVal, ok := val.(map[string]interface{}); ok {
fmt.Printf("\n")
if _, err := fmt.Fprintf(o, "\n"); err != nil {
return err
}
var sortedKeys []string
for k := range mapVal {
sortedKeys = append(sortedKeys, k)
}
sort.Strings(sortedKeys)
for _, k := range sortedKeys {
for i := 0; i < indent; i++ {
fmt.Printf(" ")
if _, err := fmt.Fprintf(o, " "); err != nil {
return err
}
}
if _, err := fmt.Fprintf(o, "%v: ", k); err != nil {
return err
}
if err := self.prettyPrintOutput(o, mapVal[k], indent+4); err != nil {
return err
}
fmt.Printf("%v: ", k)
self.prettyPrintOutput(mapVal[k], indent+4)
}
} else if sliceVal, ok := val.([]interface{}); ok {
fmt.Println()
if _, err := fmt.Fprintf(o, "\n"); err != nil {
return err
}
for _, v := range sliceVal {
for i := 0; i < indent; i++ {
fmt.Printf(" ")
if _, err := fmt.Fprintf(o, " "); err != nil {
return err
}
}
if _, err := fmt.Fprintf(o, " - "); err != nil {
return err
}
if err := self.prettyPrintOutput(o, v, indent+6); err != nil {
return err
}
fmt.Printf(" - ")
self.prettyPrintOutput(v, indent+6)
}
} else if strVal, ok := val.(string); ok {
if strings.IndexByte(strVal, '\n') > 0 {
lines := strings.Split(strVal, "\n")
fmt.Println(lines[0])
if _, err := fmt.Fprintln(o, lines[0]); err != nil {
return err
}
for _, line := range lines[1:] {
for i := 0; i < indent; i++ {
fmt.Printf(" ")
if _, err := fmt.Fprintf(o, " "); err != nil {
return err
}
}
if _, err := fmt.Fprintln(o, line); err != nil {
return err
}
fmt.Println(line)
}
} else {
fmt.Printf("%v\n", val)
if _, err := fmt.Fprintf(o, "%v\n", val); err != nil {
return err
}
}
} else {
fmt.Printf("%v\n", val)
if _, err := fmt.Fprintf(o, "%v\n", val); err != nil {
return err
}
}
return nil
}
2 changes: 1 addition & 1 deletion ziti/cmd/ziti/util/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ func outputJson(out io.Writer, data []byte) {
}

func ControllerDetailEntity(api API, entityType, entityId string, logJSON bool, out io.Writer, timeout int, verbose bool) (*gabs.Container, error) {
restClientIdentity, err := LoadSelectedRWIdentityForApi(api)
restClientIdentity, err := LoadSelectedIdentityForApi(api)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 75c96ba

Please sign in to comment.