mirror of
https://github.com/openziti/ziti.git
synced 2026-10-12 15:28:05 +00:00
Reserve -i for cli identity
This commit is contained in:
@@ -36,6 +36,7 @@ type CommonOptions struct {
|
||||
Staging bool
|
||||
ConfigIdentity string
|
||||
Timeout int
|
||||
Identity string
|
||||
}
|
||||
|
||||
func (options *CommonOptions) TimeoutContext() (context.Context, context.CancelFunc) {
|
||||
|
||||
@@ -58,8 +58,8 @@ func newCreateEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Wr
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
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().StringSliceVar(&options.edgeRouterRoles, "edge-router-roles", nil, "Edge router roles of the new edge router policy")
|
||||
cmd.Flags().StringSliceVar(&options.identityRoles, "identity-roles", nil, "Identity roles of the new edge router policy")
|
||||
cmd.Flags().StringVar(&options.semantic, "semantic", "AllOf", "Semantic dictating how multiple attributes should be interpreted. Valid values: AnyOf, AllOf")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
|
||||
@@ -785,7 +785,7 @@ func newCreatePostureCheckMfaCmd(f cmdutil.Factory, out io.Writer, errOut io.Wri
|
||||
cmd.Flags().IntVarP(&options.timeoutSeconds, "seconds", "s", -1, "Seconds an MFA posture check allows before an additional MFA code must be submitted")
|
||||
cmd.Flags().BoolVarP(&options.promptOnWake, "wake", "w", false, "Prompt for MFA code on endpoint wake")
|
||||
cmd.Flags().BoolVarP(&options.promptOnUnlock, "unlock", "u", false, "Prompt for MFA code on endpoint unlock")
|
||||
cmd.Flags().BoolVarP(&options.ignoreLegacyEndpoints, "ignore-legacy", "i", false, "Ignore prompts and timeout for endpoints that do not support MFA timeout/prompts")
|
||||
cmd.Flags().BoolVar(&options.ignoreLegacyEndpoints, "ignore-legacy", false, "Ignore prompts and timeout for endpoints that do not support MFA timeout/prompts")
|
||||
options.addPostureFlags(cmd)
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -58,8 +58,8 @@ func newCreateServiceEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOu
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
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().StringSliceVar(&options.edgeRouterRoles, "edge-router-roles", nil, "Edge router roles of the new service edge router policy")
|
||||
cmd.Flags().StringSliceVar(&options.serviceRoles, "service-roles", nil, "Identity roles of the new service edge router policy")
|
||||
cmd.Flags().StringVar(&options.semantic, "semantic", "AllOf", "Semantic dictating how multiple attributes should be interpreted. Valid values: AnyOf, AllOf")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ func newCreateServicePolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Write
|
||||
|
||||
// allow interspersing positional args and flags
|
||||
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().StringSliceVar(&options.serviceRoles, "service-roles", nil, "Service roles of the new service policy")
|
||||
cmd.Flags().StringSliceVar(&options.identityRoles, "identity-roles", nil, "Identity roles of the new service policy")
|
||||
cmd.Flags().StringVar(&options.semantic, "semantic", "AllOf", "Semantic dictating how multiple attributes should be interpreted. Valid values: AnyOf, AllOf")
|
||||
cmd.Flags().StringSliceVarP(&options.postureCheckRoles, "posture-check-roles", "p", nil, "Posture check roles of the new service policy")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
@@ -30,7 +30,6 @@ import (
|
||||
// NewCmdEdge creates a command object for the "controller" command
|
||||
func NewCmdEdge(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Command {
|
||||
cmd := util.NewEmptyParentCmd("edge", "Interact with Ziti Edge Components")
|
||||
cmd.AddCommand(newCmdEdgeController(f, out, errOut))
|
||||
populateEdgeCommands(f, out, errOut, cmd)
|
||||
return cmd
|
||||
}
|
||||
@@ -58,21 +57,14 @@ func (options *edgeOptions) ErrOutputWriter() io.Writer {
|
||||
return options.CommonOptions.Err
|
||||
}
|
||||
func (options *edgeOptions) AddCommonFlags(cmd *cobra.Command) {
|
||||
cmd.Flags().StringVarP(&options.Identity, "cli-identity", "i", "default", "Specify the saved identity you want the CLI to use when connect to the controller with")
|
||||
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")
|
||||
cmd.Flags().IntVarP(&options.Timeout, "timeout", "", 5, "Timeout for REST operations (specified in seconds)")
|
||||
cmd.Flags().BoolVarP(&options.Verbose, "verbose", "", false, "Enable verbose logging")
|
||||
}
|
||||
|
||||
// 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")
|
||||
populateEdgeCommands(f, out, errOut, cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
func populateEdgeCommands(f cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Command) *cobra.Command {
|
||||
|
||||
cmd.AddCommand(newCreateCmd(f, out, errOut))
|
||||
cmd.AddCommand(newDeleteCmd(f, out, errOut))
|
||||
cmd.AddCommand(newLoginCmd(f, out, errOut))
|
||||
|
||||
@@ -42,9 +42,9 @@ func newUpdateAuthenticatorUpdb(idType string, options edgeOptions) *cobra.Comma
|
||||
edgeOptions: options,
|
||||
}
|
||||
cmd := &cobra.Command{
|
||||
Use: idType + " (-i <identityIdOrName> -p <newPassword>) | (-c <currentPassword> -n <newPassword>)",
|
||||
Use: idType + " (--identity <identityIdOrName> -p <newPassword>) | (-c <currentPassword> -n <newPassword>)",
|
||||
Short: "allows an admin to set the updb authenticator of an identity or an authenticated session to update its authenticator ",
|
||||
Long: "The -i and -p flags are used in conjunction to set the password of an already existing updb authenticator. The -o and -n flags are used to update the current authenticated sessions updb authenticator",
|
||||
Long: "The --identity and -p flags are used in conjunction to set the password of an already existing updb authenticator. The -o and -n flags are used to update the current authenticated sessions updb authenticator",
|
||||
Args: cobra.ExactArgs(0),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
options.Cmd = cmd
|
||||
@@ -58,7 +58,7 @@ func newUpdateAuthenticatorUpdb(idType string, options edgeOptions) *cobra.Comma
|
||||
// allow interspersing positional args and flags
|
||||
cmd.Flags().SetInterspersed(true)
|
||||
|
||||
cmd.Flags().StringVarP(&updbOptions.identity, "identity", "i", "", "The id or name of the identity to update a password for, may be used with --password (requires admin)")
|
||||
cmd.Flags().StringVar(&updbOptions.identity, "identity", "", "The id or name of the identity to update a password for, may be used with --password (requires admin)")
|
||||
cmd.Flags().StringVarP(&updbOptions.identityPassword, "password", "p", "", "The password to set for an identity, may be used with --identity (requires admin), if not supplied a valued will be prompted for")
|
||||
|
||||
cmd.Flags().BoolVarP(&updbOptions.self, "self", "s", false, "Specify updating a password for the currently active identity can use --old and --new to supply passwords")
|
||||
@@ -144,7 +144,7 @@ func setIdentityPassword(identity, password string, options edgeOptions) error {
|
||||
filter := fmt.Sprintf(`identity="%s" and method="updb"`, id)
|
||||
|
||||
result, err := client.Authenticator.ListAuthenticators(&authenticator.ListAuthenticatorsParams{
|
||||
Filter: &filter,
|
||||
Filter: &filter,
|
||||
Context: context.Background(),
|
||||
}, nil)
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ func newUpdateCaCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.C
|
||||
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.identityAttributes, "identity-attributes", "i", nil, "The roles to give to identities enrolled via the CA")
|
||||
cmd.Flags().StringSliceVarP(&options.identityAttributes, "identity-attributes", "a", nil, "The roles to give to identities enrolled via the CA")
|
||||
cmd.Flags().StringVarP(&options.identityNameFormat, "identity-name-format", "f", "", "The naming format to use for identities enrolling via the CA")
|
||||
options.AddCommonFlags(cmd)
|
||||
return cmd
|
||||
|
||||
@@ -60,8 +60,8 @@ 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().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")
|
||||
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")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -222,7 +222,7 @@ func newUpdatePostureCheckMfaCmd(f cmdutil.Factory, out io.Writer, errOut io.Wri
|
||||
cmd.Flags().BoolVarP(&options.promptOnUnlock, "unlock", "u", false, "Prompt for MFA code on endpoint unlock")
|
||||
cmd.Flags().BoolVarP(&options.promptOnUnlock, "no-unlock", "q", false, "Do not prompt for MFA code on endpoint unlock")
|
||||
|
||||
cmd.Flags().BoolVarP(&options.ignoreLegacyEndpoints, "ignore-legacy", "i", false, "Ignore prompts and timeout for endpoints that do not support MFA timeout/prompts")
|
||||
cmd.Flags().BoolVar(&options.ignoreLegacyEndpoints, "ignore-legacy", false, "Ignore prompts and timeout for endpoints that do not support MFA timeout/prompts")
|
||||
cmd.Flags().BoolVarP(&options.ignoreLegacyEndpoints, "no-ignore-legacy", "l", false, "Do not ignore prompts and timeout for endpoints that do not support MFA timeout/prompts")
|
||||
|
||||
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil, "Set role attributes of the posture check. Use --role-attributes '' to set an empty list")
|
||||
|
||||
@@ -60,8 +60,8 @@ 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().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")
|
||||
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")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -61,8 +61,8 @@ 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().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")
|
||||
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")
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user