func (s *UserService) Update(ctx context.Context, name string, patches *[]common.Patch) error {
	endpoint := common.UsersEndpoint + name
	return s.Client.Modify(ctx, endpoint, http.MethodPatch, patches)
}
Update a user by name and providing an update patch

see: https://opendistro.github.io/for-elasticsearch-docs/docs/security-access-control/api/#patch-user
package security
import (
	"context"
	"github.com/WhizUs/go-opendistro/common"
	"net/http"
)
type UserService common.Service
type UserServiceInterface interface {
	Get(ctx context.Context, name string) (*User, error)
	List(ctx context.Context) (*[]User, error)
	Create(ctx context.Context, name string, userCreate *UserCreate) error
	ChangePassword(ctx context.Context, name string, newPassword string) error
	common.Modifyable
}
type UserCreate struct {
	Password     string            `json:"password,omitempty"`
	BackendRoles []string          `json:"backend_roles,omitempty"`
	Roles        []string          `json:"opendistro_security_roles"`
	Attributes   map[string]string `json:"attributes,omitempty"`
}
type User struct {
	Name         string
	Hash         string            `json:"hash"`
	Reserved     bool              `json:"reserved"`
	Hidden       bool              `json:"hidden"`
	BackendRoles []string          `json:"backend_roles"`
	Attributes   map[string]string `json:"attributes"`
	Description  string            `json:"description"`
	Static       bool              `json:"static"`
}
func (s *UserService) Get(ctx context.Context, name string) (*User, error) {
	endpoint := common.UsersEndpoint + name
	var users map[string]*User
	err := s.Client.Get(ctx, endpoint, &users)
	if err != nil {
		return nil, err
	}
	if users[name] == nil {
		return nil, nil
	}
	users[name].Name = name
	return users[name], nil
}
func (s *UserService) List(ctx context.Context) (*[]User, error) {
	var users map[string]*User
	err := s.Client.Get(ctx, common.UsersEndpoint, &users)
	if err != nil {
		return nil, err
	}
	var _users []User
	for name, user := range users {
		user.Name = name
		_users = append(_users, *user)
	}
	return &_users, nil
}
func (s *UserService) Delete(ctx context.Context, name string) error {
	endpoint := common.UsersEndpoint + name
	return s.Client.Modify(ctx, endpoint, http.MethodDelete, nil)
}
func (s *UserService) Create(ctx context.Context, name string, userCreate *UserCreate) error {
	endpoint := common.UsersEndpoint + name
	return s.Client.Modify(ctx, endpoint, http.MethodPut, userCreate)
}