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 an existing user. To change a user's password without updating any other fields, use the change password 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.MetadataVariant) *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 ¶
type NewPutUser ¶
NewPutUser type alias for index.
func NewPutUserFunc ¶
func NewPutUserFunc(tp elastictransport.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.
type PutUser ¶
type PutUser struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.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 an existing user. To change a user's password without updating any other fields, use the change password API.
https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-security-put-user
func (PutUser) Do ¶
Do runs the request through the transport, handle the response and returns a putuser.Response
func (*PutUser) ErrorTrace ¶
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace
func (*PutUser) FilterPath ¶
FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path
func (*PutUser) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*PutUser) Human ¶
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 human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human
func (*PutUser) Metadata ¶
func (r *PutUser) Metadata(metadata types.MetadataVariant) *PutUser
Arbitrary metadata that you want to associate with the user. API name: metadata
func (*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 other fields on the user (such as their roles) may be updated without modifying the user's password API name: password
func (*PutUser) 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. API name: password_hash
func (PutUser) Perform ¶
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*PutUser) Pretty ¶
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty
func (*PutUser) Raw ¶
Raw takes a json payload as input which is then passed to the http.Request If 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 value for this API is true. API name: refresh
type Request ¶
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. Metadata types.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 password Password *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) UnmarshalJSON ¶
type Response ¶
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`. Created bool `json:"created"` }
Response holds the response body struct for the package putuser