示例#1
0
// runSetPerm invokes the REST API with POST action and key prefix as
// path. The specified configuration file is read from disk and sent
// as the POST body.
func runSetPerms(cmd *cobra.Command, args []string) {
	if len(args) != 2 {
		cmd.Usage()
		return
	}

	server.RunSetPerm(Context, args[0], args[1])
}
示例#2
0
// runSetPerm invokes the REST API with POST action and key prefix as
// path. The specified configuration file is read from disk and sent
// as the POST body.
func runSetPerms(cmd *cobra.Command, args []string) {
	if len(args) != 2 {
		cmd.Usage()
		return
	}
	// Read in the config file.
	body, err := ioutil.ReadFile(args[1])
	if err != nil {
		log.Errorf("unable to read permission config file %q: %s", args[1], err)
		return
	}
	server.RunSetPerm(Context, args[0], body)
}