putuser
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
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¶
- Variables
- type NewPutUser
- type PutUser
- func (r PutUser) Do(providedCtx context.Context) (*Response, error)
- func (r *PutUser) Email(email string) *PutUser
- func (r *PutUser) Enabled(enabled bool) *PutUser
- func (r *PutUser) ErrorTrace(errortrace bool) *PutUser
- func (r *PutUser) FilterPath(filterpaths ...string) *PutUser
- func (r *PutUser) FullName(fullname string) *PutUser
- func (r *PutUser) Header(key, value string) *PutUser
- func (r *PutUser) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *PutUser) Human(human bool) *PutUser
- func (r *PutUser) Metadata(metadata types.Metadata) *PutUser
- func (r *PutUser) Password(password string) *PutUser
- func (r *PutUser) PasswordHash(passwordhash string) *PutUser
- func (r PutUser) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *PutUser) Pretty(pretty bool) *PutUser
- func (r *PutUser) Raw(raw io.Reader) *PutUser
- func (r *PutUser) Refresh(refresh refresh.Refresh) *PutUser
- func (r *PutUser) Request(req *Request) *PutUser
- func (r *PutUser) Roles(roles ...string) *PutUser
- type Request
- type Response
Constants¶
This section is empty.
Variables¶
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¶
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¶
func New(tpelastictransport.Interface) *PutUser
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¶
Do runs the request through the transport, handle the response and returns a putuser.Response
func (*PutUser)Enabled¶added inv8.9.0
Enabled Specifies whether the user is enabled.API name: enabled
func (*PutUser)ErrorTrace¶added inv8.14.0
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errorswhen they occur.API name: error_trace
func (*PutUser)FilterPath¶added inv8.14.0
FilterPath Comma-separated list of filters in dot notation which reduce the responsereturned by Elasticsearch.API name: filter_path
func (*PutUser)HttpRequest¶
HttpRequest returns the http.Request object built from thegiven parameters.
func (*PutUser)Human¶added inv8.14.0
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)Metadata¶added inv8.9.0
Metadata Arbitrary metadata that you want to associate with the user.API name: metadata
func (*PutUser)Password¶added inv8.9.0
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)PasswordHash¶added inv8.9.0
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)Perform¶added inv8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*PutUser)Pretty¶added inv8.14.0
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only usethis option for debugging only.API name: pretty
func (*PutUser)Raw¶
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¶
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
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
func (*Request)FromJSON¶added inv8.5.0
FromJSON allows to load an arbitrary json into the request structure
func (*Request)UnmarshalJSON¶added inv8.12.1
typeResponse¶added 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