mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 15:51:21 +00:00
Merge pull request #141 from openziti/ziti-cli-request-logging
Add flag to allow logging JSON requests from Ziti CLI. Fixes GH-140
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
# Release 0.15.2
|
||||
|
||||
* What's New:
|
||||
|
||||
* [#140](https://github.com/openziti/ziti/issues/140) - Allow logging JSON request for Ziti CLI
|
||||
* [#148](https://github.com/openziti/ziti/issues/148) - Show isOnline in ziti edge list edge-routers
|
||||
* [#144](https://github.com/openziti/ziti/issues/144) - Allow ziti-fabric list to use queries. Default to `true limit none`
|
||||
|
||||
* Bug Fixes:
|
||||
* [#142](https://github.com/openziti/ziti/issues/142) - fix CLI ca create not defaulting identity roles
|
||||
* [#144](https://github.com/openziti/ziti/issues/144) - ziti-fabric is only returning first 10 results for lists of services, routers and terminators
|
||||
* [#146](https://github.com/openziti/ziti/issues/146) - Export edge router JWT fails sometimes when there are more than 10 edge routers
|
||||
* [#147](https://github.com/openziti/ziti/issues/147) - Fix paging output when using 'limit none'
|
||||
* [#148](https://github.com/openziti/ziti/issues/148) - Show isOnline in ziti edge list edge-routers
|
||||
* [edge#243](https://github.com/openziti/edge/issue/243) - Session creation only returns 10 edge routers
|
||||
* [edge#245](https://github.com/openziti/edge/issue/245) - fingerprint calculation changed from 0.14 to 0.15. Ensure 0.15 routers can work with 0.14 controllers
|
||||
* [edge#248](https://github.com/openziti/edge/issue/248) - Edge Router Hello can time out on slow networks with many links to establish
|
||||
* [foundation#103](https://github.com/openziti/foundation/issues/103) - Fix config file env injection for lists
|
||||
|
||||
|
||||
# Release 0.15.1
|
||||
|
||||
* What's New:
|
||||
|
||||
@@ -86,11 +86,11 @@ func newCreateCaCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.C
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringToStringVarP(&options.tags, "tags", "t", nil, "Add tags to service definition")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().BoolVarP(&options.authEnabled, "auth", "e", false, "Whether the CA can be used for authentication or not")
|
||||
cmd.Flags().BoolVarP(&options.ottCaEnrollment, "ottca", "o", false, "Whether the CA can be used for one-time-token CA enrollment")
|
||||
cmd.Flags().BoolVarP(&options.autoCaEnrollment, "autoca", "u", false, "Whether the CA can be used for auto CA enrollment")
|
||||
cmd.Flags().StringSliceVarP(&options.identityRoles, "role-attributes", "a", []string{}, "A csv string of role attributes enrolling identities receive")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func newCreateConfigCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cob
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringVarP(&options.jsonFile, "json-file", "f", "", "Read config JSON from a file instead of the command line")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func newCreateConfigTypeCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer)
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringVarP(&options.schemaFile, "schema-file", "f", "", "Read config type JSON schema from a file instead of the command line")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -59,8 +59,9 @@ func newCreateEdgeRouterCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer)
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil, "Role attributes of the new edge router")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringVarP(&options.jwtOutputFile, "jwt-output-file", "o", "", "File to which to output the JWT used for enrolling the edge router")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ func newCreateEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Wr
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringSliceVarP(&options.edgeRouterRoles, "edge-router-roles", "e", nil, "Edge router roles of the new edge router policy")
|
||||
cmd.Flags().StringSliceVarP(&options.identityRoles, "identity-roles", "i", nil, "Identity roles of the new edge router policy")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -77,11 +77,10 @@ func newCreateIdentityOfTypeCmd(idType string, options *createIdentityOptions) *
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().BoolVarP(&options.isAdmin, "admin", "A", false, "Give the new identity admin privileges")
|
||||
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil, "Role attributes of the new identity")
|
||||
cmd.Flags().StringVarP(&options.jwtOutputFile, "jwt-output-file", "o", "", "File to which to output the JWT used for enrolling the identity")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ func newCreateServiceCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *co
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringToStringVarP(&options.tags, "tags", "t", nil, "Add tags to service definition")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil, "Role attributes of the new service")
|
||||
cmd.Flags().StringSliceVarP(&options.configs, "configs", "c", nil, "Configuration id or names to be associated with the new service")
|
||||
cmd.Flags().StringVar(&options.terminatorStrategy, "terminator-strategy", "", "Specifies the terminator strategy for the service")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ func newCreateServiceEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOu
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringSliceVarP(&options.edgeRouterRoles, "edge-router-roles", "e", nil, "Edge router roles of the new service edge router policy")
|
||||
cmd.Flags().StringSliceVarP(&options.serviceRoles, "service-roles", "s", nil, "Identity roles of the new service edge router policy")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func newCreateServicePolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Write
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringSliceVarP(&options.serviceRoles, "service-roles", "s", nil, "Service roles of the new service policy")
|
||||
cmd.Flags().StringSliceVarP(&options.identityRoles, "identity-roles", "i", nil, "Identity roles of the new service policy")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -53,13 +53,13 @@ func newSnapshotDbCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// runSnapshotDb create a new config on the Ziti Edge Controller
|
||||
func runSnapshotDb(o *snapshotDbOptions) error {
|
||||
_, err := util.EdgeControllerUpdate("database/snapshot", "", o.Out, http.MethodPost, false)
|
||||
_, err := util.EdgeControllerUpdate("database/snapshot", "", o.Out, http.MethodPost, false, false)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ func newCreateTerminatorCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer)
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringVar(&options.binding, "binding", "transport", "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')")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ func newDeleteCmdForEntityType(entityType string, command deleteCmdRunner, optio
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -179,8 +179,7 @@ func newListCmdForEntityType(entityType string, command listCommandRunner, optio
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
@@ -208,12 +207,11 @@ func newListServicesCmd(options *commonOptions) *cobra.Command {
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringVar(&asIdentity, "as-identity", "", "Allow admins to see services as they would be seen by a different identity")
|
||||
cmd.Flags().StringSliceVar(&configTypes, "config-types", nil, "Override which config types to view on services")
|
||||
cmd.Flags().StringSliceVar(&roleFilters, "role-filters", nil, "Allow filtering by roles")
|
||||
cmd.Flags().StringVar(&roleSemantic, "role-semantic", "", "Specify which roles semantic to use ")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
@@ -239,10 +237,9 @@ func newListEdgeRoutersCmd(options *commonOptions) *cobra.Command {
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVar(&roleFilters, "role-filters", nil, "Allow filtering by roles")
|
||||
cmd.Flags().StringVar(&roleSemantic, "role-semantic", "", "Specify which roles semantic to use ")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
@@ -268,10 +265,9 @@ func newListIdentitiesCmd(options *commonOptions) *cobra.Command {
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVar(&roleFilters, "role-filters", nil, "Allow filtering by roles")
|
||||
cmd.Flags().StringVar(&roleSemantic, "role-semantic", "", "Specify which roles semantic to use ")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
@@ -295,8 +291,7 @@ func newSubListCmdForEntityType(entityType string, subType string, outputF outpu
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ package edge_controller
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Jeffail/gabs"
|
||||
"github.com/openziti/foundation/util/term"
|
||||
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
|
||||
cmdutil "github.com/openziti/ziti/ziti/cmd/ziti/cmd/factory"
|
||||
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
|
||||
"github.com/openziti/ziti/ziti/cmd/ziti/util"
|
||||
"github.com/openziti/foundation/util/term"
|
||||
"github.com/spf13/cobra"
|
||||
"io"
|
||||
"path/filepath"
|
||||
@@ -70,7 +70,7 @@ func newLoginCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Comm
|
||||
|
||||
cmd.Flags().StringVarP(&options.Password, "password", "p", "", "password to use for authenticating to the Ziti Edge Controller, if -u is supplied and -p is not, a value will be prompted for")
|
||||
cmd.Flags().StringVarP(&options.Cert, "cert", "c", "", "additional root certificates used by the Ziti Edge Controller")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func newPolicyAdvisorIdentitiesCmd(f cmdutil.Factory, out io.Writer, errOut io.W
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
cmd.Flags().BoolVarP(&options.quiet, "quiet", "q", false, "Minimize output by hiding header")
|
||||
|
||||
return cmd
|
||||
@@ -101,8 +101,8 @@ func newPolicyAdvisorServicesCmd(f cmdutil.Factory, out io.Writer, errOut io.Wri
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().BoolVarP(&options.quiet, "quiet", "q", false, "Minimize output by hiding header")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -37,9 +37,15 @@ func NewCmdEdge(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Comma
|
||||
// commonOptions are common options for edge controller commands
|
||||
type commonOptions struct {
|
||||
common.CommonOptions
|
||||
OutputJSONRequest bool
|
||||
OutputJSONResponse bool
|
||||
}
|
||||
|
||||
func (options *commonOptions) AddCommonFlags(cmd *cobra.Command) {
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().BoolVar(&options.OutputJSONRequest, "output-request-json", false, "Output the full JSON request to the Ziti Edge Controller")
|
||||
}
|
||||
|
||||
// newCmdEdgeController creates a command object for the "edge controller" command
|
||||
func newCmdEdgeController(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Command {
|
||||
cmd := util.NewEmptyParentCmd("controller", "Interact with a Ziti Edge Controller")
|
||||
|
||||
@@ -71,7 +71,7 @@ func deleteEntityOfTypeWithBody(entityType string, body string, options *commonO
|
||||
|
||||
// updateEntityOfType updates an entity of the given type on the Ziti Edge Controller
|
||||
func updateEntityOfType(entityType string, body string, options *commonOptions, method string) (*gabs.Container, error) {
|
||||
return util.EdgeControllerUpdate(entityType, body, options.Out, method, options.OutputJSONResponse)
|
||||
return util.EdgeControllerUpdate(entityType, body, options.Out, method, options.OutputJSONRequest, options.OutputJSONResponse)
|
||||
}
|
||||
|
||||
func doRequest(entityType string, options *commonOptions, doRequest func(request *resty.Request, url string) (*resty.Response, error)) (*gabs.Container, error) {
|
||||
|
||||
@@ -65,7 +65,7 @@ func newUpdateConfigCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cob
|
||||
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().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ func newUpdateEdgeRouterCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer)
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the edge router")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil,
|
||||
"Set role attributes of the edge router. Use --role-attributes '' to set an empty list")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ func newUpdateEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Wr
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the edge router policy")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVarP(&options.edgeRouterRoles, "edge-router-roles", "e", nil, "Edge router roles of the edge router policy")
|
||||
cmd.Flags().StringSliceVarP(&options.identityRoles, "identity-roles", "i", nil, "Identity roles of the edge router policy")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ func newUpdateIdentityCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *c
|
||||
SuggestFor: []string{},
|
||||
}
|
||||
|
||||
options.AddCommonFlags(cmd)
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the identity")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil,
|
||||
"Set role attributes of the identity. Use --role-attributes '' to set an empty list")
|
||||
|
||||
|
||||
@@ -52,9 +52,10 @@ func newUpdateIdentityConfigsCmd(f cmdutil.Factory, out io.Writer, errOut io.Wri
|
||||
SuggestFor: []string{},
|
||||
}
|
||||
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().BoolVarP(&options.remove, "remove", "r", false, "Remove the sevice config override")
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -61,9 +61,9 @@ func newUpdateServiceCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *co
|
||||
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().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil,
|
||||
"Set role attributes of the service. Use --role-attributes '' to set an empty list")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ func newUpdateServiceEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOu
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the edge router policy")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVarP(&options.edgeRouterRoles, "edge-router-roles", "e", nil, "Edge router roles of the service edge router policy")
|
||||
cmd.Flags().StringSliceVarP(&options.serviceRoles, "service-roles", "s", nil, "Service roles of the service edge router policy")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ func newUpdateServicePolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Write
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().StringVarP(&options.name, "name", "n", "", "Set the name of the service policy")
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringSliceVarP(&options.serviceRoles, "service-roles", "s", nil, "Service roles of the service policy")
|
||||
cmd.Flags().StringSliceVarP(&options.identityRoles, "identity-roles", "i", nil, "Identity roles of the service policy")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ func newUpdateTerminatorCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer)
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringVar(&options.router, "router", "", "Set the terminator router")
|
||||
cmd.Flags().StringVar(&options.address, "address", "", "Set the terminator address")
|
||||
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')")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ import (
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
nfpem "github.com/openziti/foundation/util/pem"
|
||||
"github.com/openziti/foundation/util/term"
|
||||
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
|
||||
cmdutil "github.com/openziti/ziti/ziti/cmd/ziti/cmd/factory"
|
||||
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
|
||||
"github.com/openziti/ziti/ziti/cmd/ziti/util"
|
||||
nfpem "github.com/openziti/foundation/util/pem"
|
||||
"github.com/openziti/foundation/util/term"
|
||||
"github.com/spf13/cobra"
|
||||
"gopkg.in/resty.v1"
|
||||
"io"
|
||||
@@ -124,11 +124,11 @@ func newVerifyCaCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.C
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
cmd.Flags().StringVarP(&options.certPath, "cert", "c", "", "The path to a cert with the CN set as the verification token and signed by the target CA")
|
||||
cmd.Flags().StringVarP(&options.caCertPath, "cacert", "a", "", "The path to the CA cert that should be used to generate and sign a verification cert")
|
||||
cmd.Flags().StringVarP(&options.caKeyPath, "cakey", "k", "", "The path to the CA key that should be used to generate and sign a verification cert")
|
||||
cmd.Flags().StringVarP(&options.caKeyPassword, "password", "p", "", "The password for the CA key if necessary")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func newVersionCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Co
|
||||
SuggestFor: []string{},
|
||||
}
|
||||
|
||||
cmd.Flags().BoolVarP(&options.OutputJSONResponse, "output-json", "j", false, "Output the full JSON response from the Ziti Edge Controller")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ func EdgeControllerDelete(entityType string, id string, out io.Writer, logJSON b
|
||||
}
|
||||
|
||||
// EdgeControllerUpdate will update entities of the given type in the given Edge Controller
|
||||
func EdgeControllerUpdate(entityType string, body string, out io.Writer, method string, logJSON bool) (*gabs.Container, error) {
|
||||
func EdgeControllerUpdate(entityType string, body string, out io.Writer, method string, logRequestJson, logResponseJSON bool) (*gabs.Container, error) {
|
||||
session := &Session{}
|
||||
if err := session.Load(); err != nil {
|
||||
return nil, err
|
||||
@@ -630,6 +630,11 @@ func EdgeControllerUpdate(entityType string, body string, out io.Writer, method
|
||||
client.SetRootCertificate(session.Cert)
|
||||
}
|
||||
|
||||
if logRequestJson {
|
||||
outputJson(out, []byte(body))
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
resp, err := client.
|
||||
R().
|
||||
SetHeader("Content-Type", "application/json").
|
||||
@@ -646,7 +651,7 @@ func EdgeControllerUpdate(entityType string, body string, out io.Writer, method
|
||||
entityType, session.Host, resp.Status(), resp.String())
|
||||
}
|
||||
|
||||
if logJSON {
|
||||
if logResponseJSON {
|
||||
outputJson(out, resp.Body())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user