Merge pull request #836 from openziti/update-deps

Update deps
This commit is contained in:
Paul Lorenz
2022-09-16 15:42:17 -04:00
committed by GitHub
15 changed files with 254 additions and 29 deletions
+128
View File
@@ -2,6 +2,10 @@
## What's New
- General
- Allow filtering model entities by tag
- Fabric
- Usage v3 metrics
- Edge
- Bug Fixes
- Ziti CLI
@@ -10,6 +14,105 @@
- Identity
- Automatic File Reloads
## General
Model entities can now be filtered by tags. This works via the fabric and edge REST APIs and can be
used from the `ziti` CLI.
Example:
```
$ ziti edge update service demo --tags location=PA
$ ziti edge update service echo --tags location=NY
$ ziti edge ls services 'limit 4'
╭────────────────────────┬──────────────┬────────────┬─────────────────────┬────────────╮
│ ID │ NAME │ ENCRYPTION │ TERMINATOR STRATEGY │ ATTRIBUTES │
│ │ │ REQUIRED │ │ │
├────────────────────────┼──────────────┼────────────┼─────────────────────┼────────────┤
│ 1WztJ.YuMY │ demo │ true │ smartrouting │ │
│ 68kYZOS54kAbU4hEhKHgHT │ echo │ true │ smartrouting │ echo │
│ EjaiJkYuMY │ project.mgmt │ true │ smartrouting │ │
│ F0JVJkY40Y │ mattermost │ true │ smartrouting │ │
╰────────────────────────┴──────────────┴────────────┴─────────────────────┴────────────╯
results: 1-4 of 13
$ ziti edge ls services 'tags.location != null'
╭────────────────────────┬──────┬────────────┬─────────────────────┬────────────╮
│ ID │ NAME │ ENCRYPTION │ TERMINATOR STRATEGY │ ATTRIBUTES │
│ │ │ REQUIRED │ │ │
├────────────────────────┼──────┼────────────┼─────────────────────┼────────────┤
│ 1WztJ.YuMY │ demo │ true │ smartrouting │ │
│ 68kYZOS54kAbU4hEhKHgHT │ echo │ true │ smartrouting │ echo │
╰────────────────────────┴──────┴────────────┴─────────────────────┴────────────╯
results: 1-2 of 2
$ ziti edge ls services 'tags.location = "NY"'
╭────────────────────────┬──────┬────────────┬─────────────────────┬────────────╮
│ ID │ NAME │ ENCRYPTION │ TERMINATOR STRATEGY │ ATTRIBUTES │
│ │ │ REQUIRED │ │ │
├────────────────────────┼──────┼────────────┼─────────────────────┼────────────┤
│ 68kYZOS54kAbU4hEhKHgHT │ echo │ true │ smartrouting │ echo │
╰────────────────────────┴──────┴────────────┴─────────────────────┴────────────╯
results: 1-1 of 1
```
## Fabric
### Usage v3
This a new version of usage events available. The existing v2 version events can still be used. The version
is selected in the events configuration.
Here is a config showing how to get both sets of events:
```
events:
jsonLogger:
subscriptions:
- type: fabric.usage
version: 2
- type: fabric.usage
versin: 3
```
If no version is provided for usage, then v2 events will still be outputted by default.
### Event Consolidation
V3 events consolidate multiple usage metrics together to minimize the number of events.
Example:
```
{
"namespace": "fabric.usage",
"version": 3,
"source_id": "cjc.1kYu0",
"circuit_id": "CwbENl.lW",
"usage": {
"egress.rx": 47,
"egress.tx": 47
},
"interval_start_utc": 1663342500,
"interval_length": 60,
"tags": {
"clientId": "XtYOStBYgd",
"hostId": "f3ltEI8Iok",
"serviceId": "fclVFecdgakAoHyBvtIGy"
}
}
```
Ingress and egress usage for a given circuit will consolidated into a single event per router. Fabric usage
will also be consolided into a single, separate event.
### Event tagging
Usage events for ingress and egress usage will be annotated with edge information for both v2 and v3.
In the example above the event has tags for `clientId`, `hostId` and `serviceId`.
* `clientId` - The id of the edge identity using the service
* `hostId` - The id of the edge identity hosting the service (will be blank if not applicable, such as for router hosted)
* `serviceId` - The id of the service being used
## Edge
### Bug Fixes
@@ -94,6 +197,31 @@ Example:
╰────────────────────────┴─────────┴────────┴────────────┴─────────────┴─────────────────┴──────────────────────┴────────────────────────╯
```
## Ziti Library Updates
* github.com/openziti/channel: [v1.0.2 -> v1.0.3](https://github.com/openziti/channel/compare/v1.0.2...v1.0.3)
* github.com/openziti/edge: [v0.22.91 -> v0.23.0](https://github.com/openziti/edge/compare/v0.22.91...v0.23.0)
* [Issue #1173](https://github.com/openziti/edge/issues/1173) - Add session_type and service_id to edge session events
* [Issue #1176](https://github.com/openziti/edge/issues/1176) - Patching CA ExternalIdClaim Does Not Work
* [Issue #1174](https://github.com/openziti/edge/issues/1174) - Fix patching tags on services and transit routers
* [Issue #1154](https://github.com/openziti/edge/issues/1154) - Additional filters for service list endpoint
* github.com/openziti/fabric: [v0.19.67 -> v0.20.0](https://github.com/openziti/fabric/compare/v0.19.67...v0.20.0)
* [Issue #496](https://github.com/openziti/fabric/issues/496) - Reduce utiliztion messages by combining directionality
* [Issue #499](https://github.com/openziti/fabric/issues/499) - Fix tag patching tags on service and router
* github.com/openziti/identity: [v1.0.11 -> v1.0.12](https://github.com/openziti/identity/compare/v1.0.11...v1.0.12)
* github.com/openziti/metrics: [v1.0.7 -> v1.1.0](https://github.com/openziti/metrics/compare/v1.0.7...v1.1.0)
* [Issue #15](https://github.com/openziti/metrics/issues/15) - Support tags and multiple values on usage
* github.com/openziti/sdk-golang: [v0.16.119 -> v0.16.121](https://github.com/openziti/sdk-golang/compare/v0.16.119...v0.16.121)
* github.com/openziti/storage: [v0.1.20 -> v0.1.21](https://github.com/openziti/storage/compare/v0.1.20...v0.1.21)
* [Issue #21](https://github.com/openziti/storage/issues/21) - Support querying tags by default
* github.com/openziti/transport/v2: [v2.0.28 -> v2.0.29](https://github.com/openziti/transport/compare/v2.0.28...v2.0.29)
* github.com/openziti/ziti: [0.26.7 -> 0.26.8](https://github.com/openziti/ziti/compare/0.26.7...0.26.8)
* [Issue #835](https://github.com/openziti/ziti/issues/835) - Ensure model entity tags can be updated via CLI where appropriate
# Release 0.26.7
## What's New
+9 -9
View File
@@ -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.3
github.com/openziti/channel v1.0.2
github.com/openziti/edge v0.22.95
github.com/openziti/fabric v0.19.69
github.com/openziti/channel v1.0.3
github.com/openziti/edge v0.23.0
github.com/openziti/fabric v0.20.0
github.com/openziti/foundation/v2 v2.0.4
github.com/openziti/identity v1.0.11
github.com/openziti/metrics v1.0.7
github.com/openziti/sdk-golang v0.16.119
github.com/openziti/identity v1.0.12
github.com/openziti/metrics v1.1.0
github.com/openziti/sdk-golang v0.16.121
github.com/openziti/storage v0.1.21
github.com/openziti/transport/v2 v2.0.28
github.com/openziti/transport/v2 v2.0.29
github.com/openziti/xweb/v2 v2.0.2
github.com/openziti/ziti-db-explorer v1.1.1
github.com/pborman/uuid v1.2.0
@@ -78,7 +78,7 @@ require (
github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
github.com/go-openapi/errors v0.20.3 // indirect
@@ -161,7 +161,7 @@ require (
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-20220913175220-63ea55921009 // indirect
golang.org/x/sys v0.0.0-20220915200043-7b5979e65e41 // 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
+19 -18
View File
@@ -230,8 +230,8 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu
github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa h1:RDBNVkRviHZtvDvId8XSGPu3rmpmSe+wKRcEWNgsfWU=
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
github.com/getkin/kin-openapi v0.13.0/go.mod h1:WGRs2ZMM1Q8LR1QBEwUxC6RJEfaBcD0s+pcEVXFuAjw=
@@ -675,28 +675,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.3 h1:FtVIl5vu+xk0uwlXTqWnGHp7RqSFAzuBa1YuCPZkTsk=
github.com/openziti/agent v1.0.3/go.mod h1:k9gQv82hTTxdVSfMmD0LyWzCEy+9fWh2ISsg1llgRqU=
github.com/openziti/channel v1.0.2 h1:hNnmIHDb3RY7B0wX9TOn+XqObjfoTPWDBNjTa42nvxA=
github.com/openziti/channel v1.0.2/go.mod h1:vb2IonzG4uLmFj7UTIHTKViI2W8tHE+skFTeynZ+hJE=
github.com/openziti/channel v1.0.3 h1:WlM3DYTWxfGslct1jnUUgOHbm0wYS1LRCVwdfx8mBzU=
github.com/openziti/channel v1.0.3/go.mod h1:/te3/V0rq3r9hM0JIAlL8dlg+SynzkVE7uL6ntaYlik=
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.95 h1:24jZlqNNAxazib3qma+SbaC+8Mc7F1XEje+ckvQuBZs=
github.com/openziti/edge v0.22.95/go.mod h1:Fdjjs+eVf3nAuGfZAvlU39a4bi/tJMoBfG+Ylv63BJE=
github.com/openziti/fabric v0.19.69 h1:vCJPmANIyiq/kUaVx9CU+RljnJIpvcJaYM8fv1kiQkY=
github.com/openziti/fabric v0.19.69/go.mod h1:XSbL0gbTyhd76yYPNNg/CTJsdaYWUg3Thm8Fs9clpd0=
github.com/openziti/edge v0.23.0 h1:B5z5MPvtBV6TE6818rSyOodzdkz9bT0l64Fw2QMg/gQ=
github.com/openziti/edge v0.23.0/go.mod h1:+gCC6YBEs9eiKL0buzN+AydDbIvfRChIVNuntRMvBBo=
github.com/openziti/fabric v0.20.0 h1:kWE3Lb8xLS3Rcwwmzh4Jb0bSjgubcll7+ntx0mO76no=
github.com/openziti/fabric v0.20.0/go.mod h1:zJnnBUS8eXELmrBIyOi4x/Wyo2mslQ47+cqpAmmuJyY=
github.com/openziti/foundation/v2 v2.0.4 h1:QnpbNgRzPTnbu/QIqdNhYJl4nrhxrX7VXiIF5yIqQhc=
github.com/openziti/foundation/v2 v2.0.4/go.mod h1:L75kwCC5WTUPqxuAd3G+WMBompaElMb/nYlJjR1sJ9Q=
github.com/openziti/identity v1.0.11 h1:66tdzw5gillevcTNXZGbLxB03d/l2KTGbS4mrDJg7WY=
github.com/openziti/identity v1.0.11/go.mod h1:ScEYhB5F5FfBmTEHmfATBlbzMIpMJwDF8CcJbNuO5ic=
github.com/openziti/identity v1.0.12 h1:Y6adirthFBpMSI0fyWWGR/fUFtaMOIWQIvyr2yTeIcM=
github.com/openziti/identity v1.0.12/go.mod h1:ScEYhB5F5FfBmTEHmfATBlbzMIpMJwDF8CcJbNuO5ic=
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.7 h1:gI1Vk2HIPUwIgS42bZJ0MZx+ATfIU1Pnv5troch8R5c=
github.com/openziti/metrics v1.0.7/go.mod h1:x+2e9YQyZjf94KFWW3rr9hx+agfk50kP53vMP/6eMzo=
github.com/openziti/sdk-golang v0.16.119 h1:B51X/3/qpSNYJIF9D903nvPVR0suGw/fZvw6aNzF/bo=
github.com/openziti/sdk-golang v0.16.119/go.mod h1:ln61i+bB/Qy8IsjDzu8iw8V//PFefCY9UuhCsz60fPk=
github.com/openziti/metrics v1.1.0 h1:V3stVSxGz0Rq3GXxQz+ahMH8D3jR8yVT+IrJZNWdFxA=
github.com/openziti/metrics v1.1.0/go.mod h1:N3ffH3Vp7czCpyDSk1hFE3DZ3bTEUSiubHWHZFUuP2g=
github.com/openziti/sdk-golang v0.16.121 h1:fhjkrUnQZxC3hz9pR6zN2jkTmnzEyv8AGNyQlI1QQZU=
github.com/openziti/sdk-golang v0.16.121/go.mod h1:cdv9FOrj3XuOQR/B54OrUwaAvrd1Wwpbl1KxwJvTC2k=
github.com/openziti/storage v0.1.21 h1:m8ny8AuCqjZQRpiHUhQlmZjUGAW1LCRjrPA93WQsjP0=
github.com/openziti/storage v0.1.21/go.mod h1:onJ7mLnnB2nfKdNCJHZlVRnPZSSPUJvuu3gzZ8vR2Mo=
github.com/openziti/transport/v2 v2.0.28 h1:ptfqproXYToJR2QncsbdlRjHh7OGBlo2Jgmk+dFpNsc=
github.com/openziti/transport/v2 v2.0.28/go.mod h1:I0JnNq899+rwArGlSq9sVqCCD5c805FUv0VQgFhWNYI=
github.com/openziti/transport/v2 v2.0.29 h1:lT9FyDUF3bxkMYjFACW909LSc7sonLK86ghRDXN05Ug=
github.com/openziti/transport/v2 v2.0.29/go.mod h1:vYXp00wBXxq3s5ffSJEfkscOBH2+/d29FK1l7yMid4g=
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=
@@ -1189,12 +1189,13 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/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/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220913175220-63ea55921009 h1:PuvuRMeLWqsf/ZdT1UUZz0syhioyv1mzuFZsXs4fvhw=
golang.org/x/sys v0.0.0-20220913175220-63ea55921009/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220915200043-7b5979e65e41 h1:ohgcoMbSofXygzo6AD2I1kz3BFmW1QArPYTtwEM3UXc=
golang.org/x/sys v0.0.0-20220915200043-7b5979e65e41/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=
+12
View File
@@ -43,6 +43,7 @@ type updateCaOptions struct {
authEnabled bool
identityAttributes []string
identityNameFormat string
tags map[string]string
externalIDClaim rest_model.ExternalIDClaimPatch
}
@@ -123,6 +124,7 @@ func newUpdateCaCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().StringVarP(options.externalIDClaim.MatcherCriteria, "matcher-criteria", "x", "", "criteria used with the given matcher")
cmd.Flags().StringVarP(options.externalIDClaim.Parser, "parser", "p", "", "the parser to use on found external ids")
cmd.Flags().StringVarP(options.externalIDClaim.ParserCriteria, "parser-criteria", "z", "", "criteria used with the given parser")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -209,6 +211,16 @@ func runUpdateCa(options updateCaOptions) error {
changed = true
}
if options.Cmd.Flags().Changed("tags") {
ca.Tags = &rest_model.Tags{
SubTags: rest_model.SubTags{},
}
for k, v := range options.tags {
ca.Tags.SubTags[k] = v
}
changed = true
}
if !changed {
return errors.New("no values changed")
}
+8
View File
@@ -36,6 +36,7 @@ type updateConfigOptions struct {
name string
data string
jsonFile string
tags map[string]string
}
// newUpdateConfigCmd updates the 'edge controller update service-policy' command
@@ -65,6 +66,8 @@ func newUpdateConfigCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the config")
cmd.Flags().StringVarP(&options.data, "data", "d", "", "Set the data of the config")
cmd.Flags().StringVarP(&options.jsonFile, "json-file", "f", "", "Read config JSON from a file instead of the command line")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -100,6 +103,11 @@ func runUpdateConfig(o *updateConfigOptions) error {
}
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if len(jsonBytes) > 0 {
dataMap := map[string]interface{}{}
if err := json.Unmarshal(jsonBytes, &dataMap); err != nil {
+10 -2
View File
@@ -21,7 +21,7 @@ import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"io"
"io/ioutil"
"os"
"github.com/pkg/errors"
@@ -36,6 +36,7 @@ type updateConfigTypeAction struct {
name string
data string
jsonFile string
tags map[string]string
}
func newUpdateConfigTypeCmd(out io.Writer, errOut io.Writer) *cobra.Command {
@@ -63,6 +64,8 @@ func newUpdateConfigTypeCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().StringVarP(&action.name, "name", "n", "", "Set the name of the config")
cmd.Flags().StringVarP(&action.data, "data", "d", "", "Set the data of the config")
cmd.Flags().StringVarP(&action.jsonFile, "json-file", "f", "", "Read config JSON from a file instead of the command line")
cmd.Flags().StringToStringVar(&action.tags, "tags", nil, "Custom management tags")
action.AddCommonFlags(cmd)
return cmd
@@ -93,11 +96,16 @@ func (self *updateConfigTypeAction) run() error {
return errors.New("only one of --data and --json-file is allowed")
}
var err error
if jsonBytes, err = ioutil.ReadFile(self.jsonFile); err != nil {
if jsonBytes, err = os.ReadFile(self.jsonFile); err != nil {
return fmt.Errorf("failed to read config json file %v: %w", self.jsonFile, err)
}
}
if self.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, self.tags, "tags")
change = true
}
if len(jsonBytes) > 0 {
dataMap := map[string]interface{}{}
if err := json.Unmarshal(jsonBytes, &dataMap); err != nil {
@@ -34,6 +34,7 @@ type updateEdgeRouterPolicyOptions struct {
name string
edgeRouterRoles []string
identityRoles []string
tags map[string]string
}
func newUpdateEdgeRouterPolicyCmd(out io.Writer, errOut io.Writer) *cobra.Command {
@@ -63,6 +64,8 @@ func newUpdateEdgeRouterPolicyCmd(out io.Writer, errOut io.Writer) *cobra.Comman
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the edge router policy")
cmd.Flags().StringSliceVar(&options.edgeRouterRoles, "edge-router-roles", nil, "Edge router roles of the edge router policy")
cmd.Flags().StringSliceVar(&options.identityRoles, "identity-roles", nil, "Identity roles of the edge router policy")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -102,6 +105,11 @@ func runUpdateEdgeRouterPolicy(o *updateEdgeRouterPolicyOptions) error {
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}
@@ -113,6 +113,8 @@ func newUpdatePostureCheckMacCmd(out io.Writer, errOut io.Writer) *cobra.Command
"Set role attributes of the posture check. Use --role-attributes '' to set an empty list")
cmd.Flags().StringSliceVarP(&options.addresses, "mac-addresses", "m", nil,
"Set MAC addresses of the posture check")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
return cmd
}
@@ -140,6 +142,11 @@ func runUpdatePostureCheckMac(o *updatePostureCheckMacOptions) error {
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}
+8
View File
@@ -36,6 +36,7 @@ type updateServiceOptions struct {
roleAttributes []string
encryption encryptionVar
configs []string
tags map[string]string
}
func newUpdateServiceCmd(out io.Writer, errOut io.Writer) *cobra.Command {
@@ -68,6 +69,8 @@ func newUpdateServiceCmd(out io.Writer, errOut io.Writer) *cobra.Command {
options.encryption.Set("ON")
cmd.Flags().VarP(&options.encryption, "encryption", "e", "Controls end-to-end encryption for the service")
cmd.Flags().StringSliceVarP(&options.configs, "configs", "c", nil, "Configuration id or names to be associated with the new service")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -111,6 +114,11 @@ func runUpdateService(o *updateServiceOptions) error {
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}
@@ -34,6 +34,7 @@ type updateServiceEdgeRouterPolicyOptions struct {
name string
edgeRouterRoles []string
serviceRoles []string
tags map[string]string
}
func newUpdateServiceEdgeRouterPolicyCmd(out io.Writer, errOut io.Writer) *cobra.Command {
@@ -63,6 +64,8 @@ func newUpdateServiceEdgeRouterPolicyCmd(out io.Writer, errOut io.Writer) *cobra
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the edge router policy")
cmd.Flags().StringSliceVar(&options.edgeRouterRoles, "edge-router-roles", nil, "Edge router roles of the service edge router policy")
cmd.Flags().StringSliceVar(&options.serviceRoles, "service-roles", nil, "Service roles of the service edge router policy")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -102,6 +105,11 @@ func runUpdateServiceEdgeRouterPolicy(o *updateServiceEdgeRouterPolicyOptions) e
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}
@@ -35,6 +35,7 @@ type updateServicePolicyOptions struct {
serviceRoles []string
identityRoles []string
postureCheckRoles []string
tags map[string]string
}
func newUpdateServicePolicyCmd(out io.Writer, errOut io.Writer) *cobra.Command {
@@ -65,6 +66,8 @@ func newUpdateServicePolicyCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().StringSliceVar(&options.serviceRoles, "service-roles", nil, "Service roles of the service policy")
cmd.Flags().StringSliceVar(&options.identityRoles, "identity-roles", nil, "Identity roles of the service policy")
cmd.Flags().StringSliceVarP(&options.postureCheckRoles, "posture-check-roles", "p", nil, "Posture Check roles of the service policy")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -114,6 +117,11 @@ func runUpdateServicePolicy(o *updateServicePolicyOptions) error {
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}
@@ -37,6 +37,7 @@ type updateTerminatorOptions struct {
binding string
cost int32
precedence string
tags map[string]string
}
func newUpdateTerminatorCmd(out io.Writer, errOut io.Writer) *cobra.Command {
@@ -69,6 +70,8 @@ func newUpdateTerminatorCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().StringVar(&options.binding, "binding", "", "Set the terminator binding")
cmd.Flags().Int32VarP(&options.cost, "cost", "c", 0, "Set the terminator cost")
cmd.Flags().StringVarP(&options.precedence, "precedence", "p", "", "Set the terminator precedence ('default', 'required' or 'failed')")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -116,6 +119,11 @@ func runUpdateTerminator(o *updateTerminatorOptions) (err error) {
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}
@@ -35,6 +35,7 @@ type updateRouterOptions struct {
fingerprint string
cost uint16
noTraversal bool
tags map[string]string
}
func newUpdateRouterCmd(p common.OptionsProvider) *cobra.Command {
@@ -61,6 +62,7 @@ func newUpdateRouterCmd(p common.OptionsProvider) *cobra.Command {
cmd.Flags().StringVar(&options.fingerprint, "fingerprint", "", "Sets the router fingerprint")
cmd.Flags().Uint16Var(&options.cost, "cost", 0, "Specifies the router cost. Default 0.")
cmd.Flags().BoolVar(&options.noTraversal, "no-traversal", false, "Disallow traversal for this edge router. Default to allowed(false).")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
@@ -96,6 +98,11 @@ func runUpdateRouter(o *updateRouterOptions) error {
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}
@@ -32,6 +32,7 @@ type updateServiceOptions struct {
api.Options
name string
terminatorStrategy string
tags map[string]string
}
func newUpdateServiceCmd(p common.OptionsProvider) *cobra.Command {
@@ -56,6 +57,7 @@ func newUpdateServiceCmd(p common.OptionsProvider) *cobra.Command {
cmd.Flags().SetInterspersed(true)
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the service")
cmd.Flags().StringVar(&options.terminatorStrategy, "terminator-strategy", "", "Specifies the terminator strategy for the service")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -80,6 +82,11 @@ func runUpdateService(o *updateServiceOptions) error {
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}
@@ -37,6 +37,7 @@ type updateTerminatorOptions struct {
binding string
cost int32
precedence string
tags map[string]string
}
func newUpdateTerminatorCmd(p common.OptionsProvider) *cobra.Command {
@@ -64,6 +65,7 @@ func newUpdateTerminatorCmd(p common.OptionsProvider) *cobra.Command {
cmd.Flags().StringVar(&options.binding, "binding", "", "Set the terminator binding")
cmd.Flags().Int32VarP(&options.cost, "cost", "c", 0, "Set the terminator cost")
cmd.Flags().StringVarP(&options.precedence, "precedence", "p", "", "Set the terminator precedence ('default', 'required' or 'failed')")
cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags")
options.AddCommonFlags(cmd)
return cmd
@@ -111,6 +113,11 @@ func runUpdateTerminator(o *updateTerminatorOptions) (err error) {
change = true
}
if o.Cmd.Flags().Changed("tags") {
api.SetJSONValue(entityData, o.tags, "tags")
change = true
}
if !change {
return errors.New("no change specified. must specify at least one attribute to change")
}