Movatterモバイル変換


[0]ホーム

URL:


Notice  The highest tagged major version isv9.

putuser

package
v8.19.1Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License:Apache-2.0Imports:13Imported by:5

Details

Repository

github.com/elastic/go-elasticsearch

Links

Documentation

Overview

Create or update users.

Add and update users in the native realm.A password is required for adding a new user but is optional when updating anexisting user.To change a user's password without updating any other fields, use the changepassword API.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath =errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

typeNewPutUser

type NewPutUser func(usernamestring) *PutUser

NewPutUser type alias for index.

funcNewPutUserFunc

func NewPutUserFunc(tpelastictransport.Interface)NewPutUser

NewPutUserFunc returns a new instance of PutUser with the provided transport.Used in the index of the library this allows to retrieve every apis in once place.

typePutUser

type PutUser struct {// contains filtered or unexported fields}

funcNew

Create or update users.

Add and update users in the native realm.A password is required for adding a new user but is optional when updating anexisting user.To change a user's password without updating any other fields, use the changepassword API.

https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html

func (PutUser)Do

func (rPutUser) Do(providedCtxcontext.Context) (*Response,error)

Do runs the request through the transport, handle the response and returns a putuser.Response

func (*PutUser)Emailadded inv8.9.0

func (r *PutUser) Email(emailstring) *PutUser

Email The email of the user.API name: email

func (*PutUser)Enabledadded inv8.9.0

func (r *PutUser) Enabled(enabledbool) *PutUser

Enabled Specifies whether the user is enabled.API name: enabled

func (*PutUser)ErrorTraceadded inv8.14.0

func (r *PutUser) ErrorTrace(errortracebool) *PutUser

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errorswhen they occur.API name: error_trace

func (*PutUser)FilterPathadded inv8.14.0

func (r *PutUser) FilterPath(filterpaths ...string) *PutUser

FilterPath Comma-separated list of filters in dot notation which reduce the responsereturned by Elasticsearch.API name: filter_path

func (*PutUser)FullNameadded inv8.9.0

func (r *PutUser) FullName(fullnamestring) *PutUser

FullName The full name of the user.API name: full_name

func (*PutUser)Header

func (r *PutUser) Header(key, valuestring) *PutUser

Header set a key, value pair in the PutUser headers map.

func (*PutUser)HttpRequest

func (r *PutUser) HttpRequest(ctxcontext.Context) (*http.Request,error)

HttpRequest returns the http.Request object built from thegiven parameters.

func (*PutUser)Humanadded inv8.14.0

func (r *PutUser) Human(humanbool) *PutUser

Human When set to `true` will return statistics in a format suitable for humans.For example `"exists_time": "1h"` for humans and`"eixsts_time_in_millis": 3600000` for computers. When disabled the humanreadable values will be omitted. This makes sense for responses beingconsumedonly by machines.API name: human

func (*PutUser)Metadataadded inv8.9.0

func (r *PutUser) Metadata(metadatatypes.Metadata) *PutUser

Metadata Arbitrary metadata that you want to associate with the user.API name: metadata

func (*PutUser)Passwordadded inv8.9.0

func (r *PutUser) Password(passwordstring) *PutUser

Password The user's password.Passwords must be at least 6 characters long.When adding a user, one of `password` or `password_hash` is required.When updating an existing user, the password is optional, so that otherfields on the user (such as their roles) may be updated without modifying theuser's passwordAPI name: password

func (*PutUser)PasswordHashadded inv8.9.0

func (r *PutUser) PasswordHash(passwordhashstring) *PutUser

PasswordHash A hash of the user's password.This must be produced using the same hashing algorithm as has been configuredfor password storage.For more details, see the explanation of the`xpack.security.authc.password_hashing.algorithm` setting in the user cacheand password hash algorithm documentation.Using this parameter allows the client to pre-hash the password forperformance and/or confidentiality reasons.The `password` parameter and the `password_hash` parameter cannot be used inthe same request.API name: password_hash

func (PutUser)Performadded inv8.7.0

func (rPutUser) Perform(providedCtxcontext.Context) (*http.Response,error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*PutUser)Prettyadded inv8.14.0

func (r *PutUser) Pretty(prettybool) *PutUser

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only usethis option for debugging only.API name: pretty

func (*PutUser)Raw

func (r *PutUser) Raw(rawio.Reader) *PutUser

Raw takes a json payload as input which is then passed to the http.RequestIf specified Raw takes precedence on Request method.

func (*PutUser)Refresh

func (r *PutUser) Refresh(refreshrefresh.Refresh) *PutUser

Refresh Valid values are `true`, `false`, and `wait_for`.These values have the same meaning as in the index API, but the default valuefor this API is true.API name: refresh

func (*PutUser)Request

func (r *PutUser) Request(req *Request) *PutUser

Request allows to set the request property with the appropriate payload.

func (*PutUser)Rolesadded inv8.9.0

func (r *PutUser) Roles(roles ...string) *PutUser

Roles A set of roles the user has.The roles determine the user's access permissions.To create a user without any roles, specify an empty list (`[]`).API name: roles

typeRequest

type Request struct {// Email The email of the user.Email *string `json:"email,omitempty"`// Enabled Specifies whether the user is enabled.Enabled *bool `json:"enabled,omitempty"`// FullName The full name of the user.FullName *string `json:"full_name,omitempty"`// Metadata Arbitrary metadata that you want to associate with the user.Metadatatypes.Metadata `json:"metadata,omitempty"`// Password The user's password.// Passwords must be at least 6 characters long.// When adding a user, one of `password` or `password_hash` is required.// When updating an existing user, the password is optional, so that other// fields on the user (such as their roles) may be updated without modifying the// user's passwordPassword *string `json:"password,omitempty"`// PasswordHash A hash of the user's password.// This must be produced using the same hashing algorithm as has been configured// for password storage.// For more details, see the explanation of the// `xpack.security.authc.password_hashing.algorithm` setting in the user cache// and password hash algorithm documentation.// Using this parameter allows the client to pre-hash the password for// performance and/or confidentiality reasons.// The `password` parameter and the `password_hash` parameter cannot be used in// the same request.PasswordHash *string `json:"password_hash,omitempty"`// Roles A set of roles the user has.// The roles determine the user's access permissions.// To create a user without any roles, specify an empty list (`[]`).Roles    []string `json:"roles,omitempty"`Username *string  `json:"username,omitempty"`}

Request holds the request body struct for the package putuser

https://github.com/elastic/elasticsearch-specification/blob/470b4b9aaaa25cae633ec690e54b725c6fc939c7/specification/security/put_user/SecurityPutUserRequest.ts#L23-L101

funcNewRequestadded inv8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request)FromJSONadded inv8.5.0

func (r *Request) FromJSON(datastring) (*Request,error)

FromJSON allows to load an arbitrary json into the request structure

func (*Request)UnmarshalJSONadded inv8.12.1

func (s *Request) UnmarshalJSON(data []byte)error

typeResponseadded inv8.7.0

type Response struct {// Created A successful call returns a JSON structure that shows whether the user has// been created or updated.// When an existing user is updated, `created` is set to `false`.Createdbool `json:"created"`}

Response holds the response body struct for the package putuser

https://github.com/elastic/elasticsearch-specification/blob/470b4b9aaaa25cae633ec690e54b725c6fc939c7/specification/security/put_user/SecurityPutUserResponse.ts#L20-L28

funcNewResponseadded inv8.7.0

func NewResponse() *Response

NewResponse returns a Response

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp