diff --git a/src/Nest/XPack/Security/User/PutUser/ElasticClient-PutUser.cs b/src/Nest/XPack/Security/User/PutUser/ElasticClient-PutUser.cs index ee935b3c9b2..f81973758fc 100644 --- a/src/Nest/XPack/Security/User/PutUser/ElasticClient-PutUser.cs +++ b/src/Nest/XPack/Security/User/PutUser/ElasticClient-PutUser.cs @@ -7,41 +7,43 @@ namespace Nest { public partial interface IElasticClient { - /// + /// + /// Adds and updates users in the native realm. These users are commonly referred to as native users. + /// IPutUserResponse PutUser(Name username, Func selector = null); - /// + /// IPutUserResponse PutUser(IPutUserRequest request); - /// + /// Task PutUserAsync(Name username, Func selector = null, CancellationToken cancellationToken = default(CancellationToken) ); - /// + /// Task PutUserAsync(IPutUserRequest request, CancellationToken cancellationToken = default(CancellationToken)); } public partial class ElasticClient { - /// + /// public IPutUserResponse PutUser(Name username, Func selector = null) => PutUser(selector.InvokeOrDefault(new PutUserDescriptor(username))); - /// + /// public IPutUserResponse PutUser(IPutUserRequest request) => Dispatcher.Dispatch( request, LowLevelDispatch.XpackSecurityPutUserDispatch ); - /// + /// public Task PutUserAsync(Name username, Func selector = null, CancellationToken cancellationToken = default(CancellationToken) ) => PutUserAsync(selector.InvokeOrDefault(new PutUserDescriptor(username)), cancellationToken); - /// + /// public Task PutUserAsync(IPutUserRequest request, CancellationToken cancellationToken = default(CancellationToken)) => Dispatcher.DispatchAsync( request, diff --git a/src/Nest/XPack/Security/User/PutUser/PutUserRequest.cs b/src/Nest/XPack/Security/User/PutUser/PutUserRequest.cs index fc99bd0bd9b..2a28fed425b 100644 --- a/src/Nest/XPack/Security/User/PutUser/PutUserRequest.cs +++ b/src/Nest/XPack/Security/User/PutUser/PutUserRequest.cs @@ -6,52 +6,113 @@ namespace Nest { public partial interface IPutUserRequest { + /// + /// The email of the user. + /// [JsonProperty("email")] string Email { get; set; } + /// + /// The full name of the user. + /// [JsonProperty("full_name")] string FullName { get; set; } + /// + /// Arbitrary metadata that you want to associate with the user. + /// [JsonProperty("metadata")] IDictionary Metadata { get; set; } + /// + /// The user’s password. Passwords must be at least 6 characters long. + /// + /// + /// When adding a user, one of or 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. + /// [JsonProperty("password")] string Password { get; set; } + /// + /// A hash of the user’s password. This must be produced using the same hashing algorithm as has been configured for password storage. + /// Using this parameter allows the client to pre-hash the password for performance and/or confidentiality reasons. + /// The parameter and the parameter cannot be used in the same request. + /// + [JsonProperty("password_hash")] + string PasswordHash { get; set; } + + /// + /// 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. + /// [JsonProperty("roles")] IEnumerable Roles { get; set; } } public partial class PutUserRequest { + /// public string Email { get; set; } + + /// public string FullName { get; set; } + + /// public IDictionary Metadata { get; set; } + + /// public string Password { get; set; } + + /// + public string PasswordHash { get; set; } + + /// public IEnumerable Roles { get; set; } } [DescriptorFor("XpackSecurityPutUser")] public partial class PutUserDescriptor { + /// string IPutUserRequest.Email { get; set; } + + /// string IPutUserRequest.FullName { get; set; } + + /// IDictionary IPutUserRequest.Metadata { get; set; } + + /// string IPutUserRequest.Password { get; set; } + + /// + string IPutUserRequest.PasswordHash { get; set; } + + /// IEnumerable IPutUserRequest.Roles { get; set; } + /// public PutUserDescriptor Password(string password) => Assign(password, (a, v) => a.Password = v); + /// + public PutUserDescriptor PasswordHash(string passwordHash) => Assign(passwordHash, (a, v) => a.PasswordHash = v); + + /// public PutUserDescriptor Roles(IEnumerable roles) => Assign(roles, (a, v) => a.Roles = v); + /// public PutUserDescriptor Roles(params string[] roles) => Assign(roles, (a, v) => a.Roles = v); + /// public PutUserDescriptor FullName(string fullName) => Assign(fullName, (a, v) => a.FullName = v); + /// public PutUserDescriptor Email(string email) => Assign(email, (a, v) => a.Email = v); + /// public PutUserDescriptor Metadata(IDictionary metadata) => Assign(metadata, (a, v) => a.Metadata = v); + /// public PutUserDescriptor Metadata(Func, IDictionary> selector) => Assign(selector, (a, v) => a.Metadata = v?.Invoke(new FluentDictionary())); }