Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddCmd = &cobra.Command{ Use: "add", Short: "Add client with key", Long: `Add client and related public key. For example: mim client add <clientid> -file <key.pub> or mim client add <clientid> -f <key.pub> `, 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) publicKey, err := utils.ReadInput(file) utils.HandleError(err) pterm.Success.Println("Read public key file") sm := api.NewSecurityManager(server, token) err = sm.AddClient(clientId, publicKey) utils.HandleError(err) pterm.Success.Println("Added client to server") pterm.Println() }, TraverseChildren: true, }
addCmd represents the add command
View Source
var DeleteCmd = &cobra.Command{ Use: "delete", Short: "Delete client with key", Long: `Delete client and related public key. For example: mim client delete <clientid> `, 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] sm := api.NewSecurityManager(server, token) err = sm.DeleteClient(clientId) utils.HandleError(err) pterm.Success.Println("Removed client from server") pterm.Println() }, TraverseChildren: true, }
addCmd represents the add command
View Source
var ListCmd = &cobra.Command{ Use: "list", Aliases: []string{"ls"}, Short: "List all clients", Long: `List all clients. For example: mim client list `, 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() pterm.DefaultSection.Println("Listing clients on " + server + "/clients") sm := api.NewSecurityManager(server, token) clients, err := sm.ListClients() utils.HandleError(err) out, err := json.Marshal(clients) utils.HandleError(err) fmt.Println(string(out)) }, TraverseChildren: true, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.