Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddCmd = &cobra.Command{ Use: "add", Short: "Add acl for client", Long: `Add acl for client with id. For example: mim acl add <clientid> -file acls.json or mim acl add <clientid> -f acls.json `, Run: func(cmd *cobra.Command, args []string) { format := utils.ResolveFormat(cmd) if format == "json" { pterm.DisableOutput() } server, token, err := login.ResolveCredentials() utils.HandleError(err) pterm.EnableDebugMessages() clientId := args[0] file, err := cmd.Flags().GetString("file") utils.HandleError(err) acls, err := utils.ReadInput(file) utils.HandleError(err) pterm.Success.Println("Read acl file") sm := api.NewSecurityManager(server, token) err = sm.AddClientAcl(clientId, acls) utils.HandleError(err) pterm.Success.Println("Set acl for client on server") pterm.Println() }, TraverseChildren: true, }
addCmd represents the add command
View Source
var GetCmd = &cobra.Command{ Use: "get", Short: "Get ACL for given client", Long: `Get the ACL with given name, For example: mim acl get <name> `, Run: func(cmd *cobra.Command, args []string) { format := utils.ResolveFormat(cmd) if format == "json" { pterm.DisableOutput() } server, token, err := login.ResolveCredentials() utils.HandleError(err) clientId, err := cmd.Flags().GetString("clientId") utils.HandleError(err) if len(args) > 0 && clientId == "" { clientId = args[0] } if clientId == "" { pterm.Warning.Println("You must provide a clientId") pterm.Println() os.Exit(1) } pterm.EnableDebugMessages() sm := api.NewSecurityManager(server, token) clients, err := sm.GetClientAcl(clientId) utils.HandleError(err) out, err := json.Marshal(clients) utils.HandleError(err) fmt.Println(string(out)) }, TraverseChildren: true, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { if len(args) != 0 { return nil, cobra.ShellCompDirectiveNoFileComp } return api.GetClientsCompletion(toComplete), cobra.ShellCompDirectiveNoFileComp }, }
deleteCmd represents the delete command
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.