diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj b/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj index 3102296184f..30346631c92 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj @@ -194,6 +194,7 @@ + diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiUrlPart.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiUrlPart.cs index 2144767a394..7866da278ef 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiUrlPart.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiUrlPart.cs @@ -29,7 +29,12 @@ public string ClrTypeName case "repository": case "snapshot": case "lang": - case "name": return this.Type == "string" ? "Name" : "Names"; + case "username": + case "usernames": + case "realm": + case "realms": + case "name": + return this.Type == "string" ? "Name" : "Names"; case "task_id": return "TaskId"; default: return this.Type + "_"; } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Program.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Program.cs index 4e0d9f49bc8..b11f5f0f653 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Program.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Program.cs @@ -28,7 +28,7 @@ static void Main(string[] args) if (redownloadCoreSpecification) RestSpecDownloader.Download(downloadBranch); - ApiGenerator.Generate("Core", "DeleteByQuery"); + ApiGenerator.Generate("Core", "DeleteByQuery", "Graph", "License", "Shield"); //ApiGenerator.Generate("Core", "Graph", "License"); //ApiGenerator.Generate(); //generates everything under ApiSpecification } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Graph/graph.explore.json b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Graph/graph.explore.json index 02ea75fcadd..940472639ae 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Graph/graph.explore.json +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Graph/graph.explore.json @@ -7,8 +7,9 @@ "paths": ["/{index}/_graph/explore", "/{index}/{type}/_graph/explore"], "parts" : { "index": { - "type" : "list", - "description" : "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + "required" : true, + "type": "list", + "description": "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" }, "type": { "type" : "list", diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/License/license.delete.json b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/License/license.delete.json new file mode 100644 index 00000000000..9b7ecd8382d --- /dev/null +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/License/license.delete.json @@ -0,0 +1,13 @@ +{ + "license.delete": { + "documentation": "https://www.elastic.co/guide/en/shield/current/license-management.html", + "methods": ["DELETE"], + "url": { + "path": "/_license", + "paths": ["/_license"], + "parts" : { }, + "params": { } + }, + "body": null + } +} diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_realms.json b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_realms.json index 54fc8c0e68b..52fc6bcc98f 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_realms.json +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_realms.json @@ -7,14 +7,14 @@ "paths": [ "/_shield/realm/{realms}/_clear_cache" ], "parts": { "realms": { - "type" : "string", + "type" : "list", "description" : "Comma-separated list of realms to clear", "required" : true } }, "params": { "usernames": { - "type" : "string", + "type" : "list", "description" : "Comma-separated list of usernames to clear from the cache", "required" : false } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_roles.json b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_roles.json index ea6aa06923b..8d5eb3338f7 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_roles.json +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_roles.json @@ -1,13 +1,13 @@ { "shield.clear_cached_roles": { "documentation": "Clears the internal caches for specified roles", - "methods": [ "PUT", "POST" ], + "methods": [ "POST" ], "url": { "path": "/_shield/role/{name}/_clear_cache", "paths": [ "/_shield/role/{name}/_clear_cache" ], "parts": { "name": { - "type" : "string", + "type" : "list", "description" : "Role name", "required" : true } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Views/_Requests.Generated.cshtml b/src/CodeGeneration/CodeGeneration.LowLevelClient/Views/_Requests.Generated.cshtml index ea7a78ebf3a..77da716bae9 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Views/_Requests.Generated.cshtml +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Views/_Requests.Generated.cshtml @@ -43,7 +43,7 @@ namespace Nest } } ///Request parameters for @method.FullName
@method.Documentation
- public partial class @Raw(method.RequestType + method.RequestTypeGeneric) @Raw(string.Format(" : RequestBase<{0}>, {1}", method.QueryStringParamName, method.InterfaceType)) + public partial class @Raw(method.RequestType + method.RequestTypeGeneric) @Raw(string.Format(" : PlainRequestBase<{0}>, {1}", method.QueryStringParamName, method.InterfaceType)) { protected @(Raw(method.InterfaceType)) Self => this; @foreach (ApiUrlPart part in method.AllParts.Where(p=>!ApiUrl.BlackListRouteValues.Contains(p.Name))) diff --git a/src/Elasticsearch.Net/Configuration/ConnectionConfiguration.cs b/src/Elasticsearch.Net/Configuration/ConnectionConfiguration.cs index 0049770ca41..4d0ea5c0e6a 100644 --- a/src/Elasticsearch.Net/Configuration/ConnectionConfiguration.cs +++ b/src/Elasticsearch.Net/Configuration/ConnectionConfiguration.cs @@ -13,7 +13,7 @@ namespace Elasticsearch.Net { /// - /// ConnectionConfiguration allows you to control how ElasticLowLevelClient behaves and where/how it connects + /// ConnectionConfiguration allows you to control how ElasticLowLevelClient behaves and where/how it connects /// to elasticsearch /// public class ConnectionConfiguration : ConnectionConfiguration @@ -23,7 +23,7 @@ public class ConnectionConfiguration : ConnectionConfiguration - /// ConnectionConfiguration allows you to control how ElasticLowLevelClient behaves and where/how it connects + /// ConnectionConfiguration allows you to control how ElasticLowLevelClient behaves and where/how it connects /// to elasticsearch /// /// The root of the elasticsearch node we want to connect to. Defaults to http://localhost:9200 @@ -33,12 +33,12 @@ public ConnectionConfiguration(Uri uri = null) { } /// - /// ConnectionConfiguration allows you to control how ElasticLowLevelClient behaves and where/how it connects + /// ConnectionConfiguration allows you to control how ElasticLowLevelClient behaves and where/how it connects /// to elasticsearch /// /// A connection pool implementation that'll tell the client what nodes are available public ConnectionConfiguration(IConnectionPool connectionPool) - // ReSharper disable once IntroduceOptionalParameters.Global + // ReSharper disable once IntroduceOptionalParameters.Global : this(connectionPool, null, null) { } @@ -208,7 +208,7 @@ public T EnableTcpKeepAlive(TimeSpan keepAliveTime, TimeSpan keepAliveInterval) /// /// Instead of following a c/go like error checking on response.IsValid always throw an exception - /// on the client when a call resulted in an exception on either the client or the Elasticsearch server. + /// on the client when a call resulted in an exception on either the client or the Elasticsearch server. /// Reasons for such exceptions could be search parser errors, index missing exceptions, etc... /// public T ThrowExceptions(bool alwaysThrow = true) => Assign(a => a._throwExceptions = alwaysThrow); @@ -252,7 +252,7 @@ public T EnableTcpKeepAlive(TimeSpan keepAliveTime, TimeSpan keepAliveInterval) public T DeadTimeout(TimeSpan timeout) => Assign(a => a._deadTimeout = timeout); /// - /// Sets the maximum time a node can be marked dead. + /// Sets the maximum time a node can be marked dead. /// Different implementations of IConnectionPool may choose a different default. /// /// The timeout in milliseconds @@ -279,7 +279,7 @@ public T Proxy(Uri proxyAdress, string username, string password) } /// - /// Forces all requests to have ?pretty=true, causing elasticsearch to return formatted json. + /// Forces all requests to have ?pretty=true, causing elasticsearch to return formatted json. /// Also forces the client to send out formatted json. Defaults to false /// public T PrettyJson(bool b = true) => Assign(a => @@ -310,7 +310,7 @@ public T BasicAuthentication(string userName, string password) { this._basicAuthCredentials = new BasicAuthenticationCredentials { - UserName = userName, + Username = userName, Password = password }; return (T)this; diff --git a/src/Elasticsearch.Net/Configuration/IConnectionConfigurationValues.cs b/src/Elasticsearch.Net/Configuration/IConnectionConfigurationValues.cs index 81b851780e7..dc167ae2391 100644 --- a/src/Elasticsearch.Net/Configuration/IConnectionConfigurationValues.cs +++ b/src/Elasticsearch.Net/Configuration/IConnectionConfigurationValues.cs @@ -11,10 +11,10 @@ public interface IConnectionConfigurationValues : IDisposable /// The connection pool to use when talking with elasticsearch IConnectionPool ConnectionPool { get; } - + /// The connection implementation to use when talking with elasticsearch IConnection Connection { get; } - + /// The serializer to use to serialize requests and deserialize responses IElasticsearchSerializer Serializer { get; } @@ -32,7 +32,7 @@ public interface IConnectionConfigurationValues : IDisposable /// The time to put dead nodes out of rotation (this will be multiplied by the number of times they've been dead) /// TimeSpan? DeadTimeout { get; } - + /// /// The maximum ammount of time a node is allowed to marked dead /// @@ -63,16 +63,16 @@ public interface IConnectionConfigurationValues : IDisposable /// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-http.html /// bool EnableHttpCompression { get; } - + /// /// When set will force all connections through this proxy /// string ProxyAddress { get; } string ProxyUsername { get; } string ProxyPassword { get; } - + /// - /// Forces all requests to have ?pretty=true, causing elasticsearch to return formatted json. + /// Forces all requests to have ?pretty=true, causing elasticsearch to return formatted json. /// Also forces the client to send out formatted json. Defaults to false /// bool PrettyJson { get; } @@ -97,10 +97,10 @@ public interface IConnectionConfigurationValues : IDisposable /// /// Instead of following a c/go like error checking on response.IsValid always throw an exception - /// on the client when a call resulted in an exception on either the client or the Elasticsearch server. + /// on the client when a call resulted in an exception on either the client or the Elasticsearch server. /// Reasons for such exceptions could be search parser errors, index missing exceptions, etc... /// - bool ThrowExceptions { get; } + bool ThrowExceptions { get; } /// /// Sniff the cluster state immediatly on startup @@ -137,18 +137,18 @@ public interface IConnectionConfigurationValues : IDisposable /// Basic access authorization credentials to specify with all requests. /// BasicAuthenticationCredentials BasicAuthenticationCredentials { get; } - + /// /// KeepAliveTime - specifies the timeout, in milliseconds, with no - /// activity until the first keep-alive packet is sent. + /// activity until the first keep-alive packet is sent. /// TimeSpan? KeepAliveTime { get; } /// /// KeepAliveInterval - specifies the interval, in milliseconds, between - /// when successive keep-alive packets are sent if no acknowledgement is - /// received. + /// when successive keep-alive packets are sent if no acknowledgement is + /// received. /// TimeSpan? KeepAliveInterval { get; } } -} \ No newline at end of file +} diff --git a/src/Elasticsearch.Net/Configuration/RequestConfiguration.cs b/src/Elasticsearch.Net/Configuration/RequestConfiguration.cs index f105673f5a6..d191abb1717 100644 --- a/src/Elasticsearch.Net/Configuration/RequestConfiguration.cs +++ b/src/Elasticsearch.Net/Configuration/RequestConfiguration.cs @@ -4,7 +4,7 @@ namespace Elasticsearch.Net { - public interface IRequestConfiguration + public interface IRequestConfiguration { /// /// The timeout for this specific request, takes precedence over the global timeout settings @@ -20,7 +20,7 @@ public interface IRequestConfiguration /// Force a difference content type header on the request /// string ContentType { get; set; } - + /// /// This will override whatever is set on the connection configuration or whatever default the connectionpool has. /// @@ -32,13 +32,13 @@ public interface IRequestConfiguration Uri ForceNode { get; set; } /// - /// Forces no sniffing to occur on the request no matter what configuration is in place + /// Forces no sniffing to occur on the request no matter what configuration is in place /// globally /// bool? DisableSniff { get; set; } /// - /// Under no circumstance do a ping before the actual call. If a node was previously dead a small ping with + /// Under no circumstance do a ping before the actual call. If a node was previously dead a small ping with /// low connect timeout will be tried first in normal circumstances /// bool? DisablePing { get; set; } @@ -63,13 +63,19 @@ public interface IRequestConfiguration /// The cancellation token to use to internally to cancel async operations /// CancellationToken CancellationToken { get; set; } + + /// + /// Submit the request on behalf in the context of a different shield user + ///
https://www.elastic.co/guide/en/shield/current/submitting-requests-for-other-users.html
+		/// 
+ string RunAs { get; set; } } public class RequestConfiguration : IRequestConfiguration { public TimeSpan? RequestTimeout { get; set; } public TimeSpan? PingTimeout { get; set; } - public string ContentType { get; set; } + public string ContentType { get; set; } public int? MaxRetries { get; set; } public Uri ForceNode { get; set; } public bool? DisableSniff { get; set; } @@ -77,34 +83,56 @@ public class RequestConfiguration : IRequestConfiguration public IEnumerable AllowedStatusCodes { get; set; } public BasicAuthenticationCredentials BasicAuthenticationCredentials { get; set; } public bool EnableHttpPipelining { get; set; } = true; - public CancellationToken CancellationToken { get; set; } + public CancellationToken CancellationToken { get; set; } + /// + /// Submit the request on behalf in the context of a different user + /// https://www.elastic.co/guide/en/shield/current/submitting-requests-for-other-users.html + /// + public string RunAs { get; set; } } public class RequestConfigurationDescriptor : IRequestConfiguration { - private IRequestConfiguration Self => this; + private IRequestConfiguration Self => this; TimeSpan? IRequestConfiguration.RequestTimeout { get; set; } - TimeSpan? IRequestConfiguration.PingTimeout { get; set; } - string IRequestConfiguration.ContentType { get; set; } - int? IRequestConfiguration.MaxRetries { get; set; } - Uri IRequestConfiguration.ForceNode { get; set; } - bool? IRequestConfiguration.DisableSniff { get; set; } - bool? IRequestConfiguration.DisablePing { get; set; } - IEnumerable IRequestConfiguration.AllowedStatusCodes { get; set; } - BasicAuthenticationCredentials IRequestConfiguration.BasicAuthenticationCredentials { get; set; } - bool IRequestConfiguration.EnableHttpPipelining { get; set; } = true; - CancellationToken IRequestConfiguration.CancellationToken { get; set; } + string IRequestConfiguration.RunAs { get; set; } + + public RequestConfigurationDescriptor(IRequestConfiguration config) + { + Self.RequestTimeout = config?.RequestTimeout; + Self.PingTimeout = config?.PingTimeout; + Self.ContentType = config?.ContentType; + Self.MaxRetries = config?.MaxRetries; + Self.ForceNode = config?.ForceNode; + Self.DisableSniff = config?.DisableSniff; + Self.DisablePing = config?.DisablePing; + Self.AllowedStatusCodes = config?.AllowedStatusCodes; + Self.BasicAuthenticationCredentials = config?.BasicAuthenticationCredentials; + Self.EnableHttpPipelining = config?.EnableHttpPipelining ?? true; + Self.CancellationToken = config?.CancellationToken ?? default(CancellationToken); + Self.RunAs = config?.RunAs; + } + + /// + /// Submit the request on behalf in the context of a different shield user + ///
https://www.elastic.co/guide/en/shield/current/submitting-requests-for-other-users.html
+		/// 
+ public RequestConfigurationDescriptor RunAs(string username) + { + Self.RunAs = username; + return this; + } public RequestConfigurationDescriptor RequestTimeout(TimeSpan requestTimeout) { @@ -168,7 +196,7 @@ public RequestConfigurationDescriptor BasicAuthentication(string userName, strin { if (Self.BasicAuthenticationCredentials == null) Self.BasicAuthenticationCredentials = new BasicAuthenticationCredentials(); - Self.BasicAuthenticationCredentials.UserName = userName; + Self.BasicAuthenticationCredentials.Username = userName; Self.BasicAuthenticationCredentials.Password = password; return this; } @@ -179,4 +207,4 @@ public RequestConfigurationDescriptor EnableHttpPipelining(bool enable = true) return this; } } -} \ No newline at end of file +} diff --git a/src/Elasticsearch.Net/Configuration/Security/BasicAuthenticationCredentials.cs b/src/Elasticsearch.Net/Configuration/Security/BasicAuthenticationCredentials.cs new file mode 100644 index 00000000000..eba77acafdd --- /dev/null +++ b/src/Elasticsearch.Net/Configuration/Security/BasicAuthenticationCredentials.cs @@ -0,0 +1,17 @@ +using System; + +namespace Elasticsearch.Net +{ + public class BasicAuthenticationCredentials + { + public string Username { get; set; } + [Obsolete("Scheduled to be removed use Username instead, note the lowercase n")] + public string UserName { get { return Username; } set { Username = value; } } + public string Password { get; set; } + + public override string ToString() + { + return this.Username + ":" + this.Password; + } + } +} diff --git a/src/Elasticsearch.Net/Configuration/Security/BasicAuthorizationCredentials.cs b/src/Elasticsearch.Net/Configuration/Security/BasicAuthorizationCredentials.cs deleted file mode 100644 index 16747c66b84..00000000000 --- a/src/Elasticsearch.Net/Configuration/Security/BasicAuthorizationCredentials.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Elasticsearch.Net -{ - public class BasicAuthenticationCredentials - { - public string UserName { get; set; } - public string Password { get; set; } - - public override string ToString() - { - return this.UserName + ":" + this.Password; - } - } -} diff --git a/src/Elasticsearch.Net/Connection/HttpConnection.cs b/src/Elasticsearch.Net/Connection/HttpConnection.cs index 26813993c7b..8460499ccd0 100644 --- a/src/Elasticsearch.Net/Connection/HttpConnection.cs +++ b/src/Elasticsearch.Net/Connection/HttpConnection.cs @@ -49,6 +49,8 @@ protected virtual HttpWebRequest CreateWebRequest(RequestData requestData) request.Headers.Add("Accept-Encoding", "gzip,deflate"); request.Headers.Add("Content-Encoding", "gzip"); } + if (!requestData.RunAs.IsNullOrEmpty()) + request.Headers.Add("es-shield-runas-user", requestData.RunAs); if (requestData.Headers != null && requestData.Headers.HasKeys()) request.Headers.Add(requestData.Headers); diff --git a/src/Elasticsearch.Net/Domain/RequestParameters/FluentRequestParameters.cs b/src/Elasticsearch.Net/Domain/RequestParameters/FluentRequestParameters.cs index 27f4e92c5b1..88e287f9630 100644 --- a/src/Elasticsearch.Net/Domain/RequestParameters/FluentRequestParameters.cs +++ b/src/Elasticsearch.Net/Domain/RequestParameters/FluentRequestParameters.cs @@ -9,7 +9,7 @@ namespace Elasticsearch.Net /// You can always pass a simple NameValueCollection if you want. /// /// - public abstract class FluentRequestParameters : IRequestParameters + public abstract class FluentRequestParameters : IRequestParameters where T : FluentRequestParameters { private IRequestParameters Self => this; @@ -45,10 +45,10 @@ public T RemoveQueryString(string name) public T RequestConfiguration(Func selector) { - Self.RequestConfiguration = selector?.Invoke(new RequestConfigurationDescriptor()) ?? Self.RequestConfiguration; + Self.RequestConfiguration = selector?.Invoke(new RequestConfigurationDescriptor(Self.RequestConfiguration)) ?? Self.RequestConfiguration; return (T)this; } - + public T DeserializationOverride(Func customResponseCreator) { Self.DeserializationOverride = customResponseCreator; diff --git a/src/Elasticsearch.Net/Domain/RequestParameters/IRequestParameters.cs b/src/Elasticsearch.Net/Domain/RequestParameters/IRequestParameters.cs index e91e2647527..c151a0d0dd3 100644 --- a/src/Elasticsearch.Net/Domain/RequestParameters/IRequestParameters.cs +++ b/src/Elasticsearch.Net/Domain/RequestParameters/IRequestParameters.cs @@ -27,5 +27,7 @@ public interface IRequestParameters TOut GetQueryStringValue(string name); void AddQueryStringValue(string name, object value); + + } -} \ No newline at end of file +} diff --git a/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs b/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs index 035f2cec237..3335fd94f1e 100644 --- a/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs +++ b/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs @@ -4515,4 +4515,258 @@ public class DeleteByQueryRequestParameters : FluentRequestParameters this.AddQueryString("filter_path", filter_path); } + + ///Request parameters descriptor for GraphExplore + ///
+	///https://www.elastic.co/guide/en/graph/current/explore.html
+	///
+ ///
+ public class GraphExploreRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Specific routing value + public GraphExploreRequestParameters Routing(string routing) => this.AddQueryString("routing", routing); + + + ///Explicit operation timeout + public GraphExploreRequestParameters Timeout(TimeSpan timeout) => this.AddQueryString("timeout", timeout.ToTimeUnit()); + + + ///The URL-encoded request definition + public GraphExploreRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public GraphExploreRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for LicenseDelete + ///
+	///https://www.elastic.co/guide/en/shield/current/license-management.html
+	///
+ ///
+ public class DeleteLicenseRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + + ///The URL-encoded request definition + public DeleteLicenseRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public DeleteLicenseRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for LicenseGet + ///
+	///https://www.elastic.co/guide/en/shield/current/license-management.html
+	///
+ ///
+ public class GetLicenseRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///Return local information, do not retrieve the state from master node (default: false) + public GetLicenseRequestParameters Local(bool local) => this.AddQueryString("local", local); + + + ///The URL-encoded request definition + public GetLicenseRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public GetLicenseRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for LicensePost + ///
+	///https://www.elastic.co/guide/en/shield/current/license-management.html
+	///
+ ///
+ public class PostLicenseRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; + + ///whether the user has acknowledged acknowledge messages (default: false) + public PostLicenseRequestParameters Acknowledge(bool acknowledge) => this.AddQueryString("acknowledge", acknowledge); + + + ///The URL-encoded request definition + public PostLicenseRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public PostLicenseRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldAuthenticate + ///
+	///Retrieve details about the currently authenticated user
+	///
+ ///
+ public class AuthenticateRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///The URL-encoded request definition + public AuthenticateRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public AuthenticateRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldClearCachedRealms + ///
+	///Clears the internal user caches for specified realms
+	///
+ ///
+ public class ClearCachedRealmsRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Comma-separated list of usernames to clear from the cache + public ClearCachedRealmsRequestParameters Usernames(params string[] usernames) => this.AddQueryString("usernames", usernames); + + + ///The URL-encoded request definition + public ClearCachedRealmsRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public ClearCachedRealmsRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldClearCachedRoles + ///
+	///Clears the internal caches for specified roles
+	///
+ ///
+ public class ClearCachedRolesRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///The URL-encoded request definition + public ClearCachedRolesRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public ClearCachedRolesRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldDeleteRole + ///
+	///Remove a role from the native shield realm
+	///
+ ///
+ public class DeleteRoleRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + + ///The URL-encoded request definition + public DeleteRoleRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public DeleteRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldDeleteUser + ///
+	///Remove a user from the native shield realm
+	///
+ ///
+ public class DeleteUserRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + + ///The URL-encoded request definition + public DeleteUserRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public DeleteUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldGetRole + ///
+	///Retrieve one or more roles from the native shield realm
+	///
+ ///
+ public class GetRoleRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///The URL-encoded request definition + public GetRoleRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public GetRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldGetUser + ///
+	///Retrieve one or more users from the native shield realm
+	///
+ ///
+ public class GetUserRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///The URL-encoded request definition + public GetUserRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public GetUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldPutRole + ///
+	///Update or create a role for the native shield realm
+	///
+ ///
+ public class PutRoleRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; + + ///The URL-encoded request definition + public PutRoleRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public PutRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for ShieldPutUser + ///
+	///Update or create a user for the native shield realm
+	///
+ ///
+ public class PutUserRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; + + ///The URL-encoded request definition + public PutUserRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///Comma separated list of filters used to reduce the response returned by Elasticsearch + public PutUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + + } } \ No newline at end of file diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs index be2c5c5f578..07ba19f2f68 100644 --- a/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs +++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs @@ -8285,6 +8285,572 @@ public ElasticsearchResponse DeleteByQuery(string index, string type, Post public Task> DeleteByQueryAsync(string index, string type, PostData body, Func requestParameters = null) where T : class => this.DoRequestAsync(DELETE, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_query"), body, _params(requestParameters)); + ///Represents a GET on /{index}/_graph/explore + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse GraphExploreGet(string index, Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"{index.NotNull("index")}/_graph/explore"), null, _params(requestParameters)); + + ///Represents a GET on /{index}/_graph/explore + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> GraphExploreGetAsync(string index, Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"{index.NotNull("index")}/_graph/explore"), null, _params(requestParameters)); + + ///Represents a GET on /{index}/{type}/_graph/explore + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A comma-separated list of document types to search; leave empty to perform the operation on all types + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse GraphExploreGet(string index, string type, Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), null, _params(requestParameters)); + + ///Represents a GET on /{index}/{type}/_graph/explore + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A comma-separated list of document types to search; leave empty to perform the operation on all types + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> GraphExploreGetAsync(string index, string type, Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), null, _params(requestParameters)); + + ///Represents a POST on /{index}/_graph/explore + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///Graph Query DSL + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse GraphExplore(string index, PostData body, Func requestParameters = null) + where T : class => this.DoRequest(POST, Url($"{index.NotNull("index")}/_graph/explore"), body, _params(requestParameters)); + + ///Represents a POST on /{index}/_graph/explore + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///Graph Query DSL + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> GraphExploreAsync(string index, PostData body, Func requestParameters = null) + where T : class => this.DoRequestAsync(POST, Url($"{index.NotNull("index")}/_graph/explore"), body, _params(requestParameters)); + + ///Represents a POST on /{index}/{type}/_graph/explore + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A comma-separated list of document types to search; leave empty to perform the operation on all types + ///Graph Query DSL + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse GraphExplore(string index, string type, PostData body, Func requestParameters = null) + where T : class => this.DoRequest(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), body, _params(requestParameters)); + + ///Represents a POST on /{index}/{type}/_graph/explore + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A comma-separated list of document types to search; leave empty to perform the operation on all types + ///Graph Query DSL + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> GraphExploreAsync(string index, string type, PostData body, Func requestParameters = null) + where T : class => this.DoRequestAsync(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), body, _params(requestParameters)); + + ///Represents a DELETE on /_license + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse LicenseDelete(Func requestParameters = null) + where T : class => this.DoRequest(DELETE, Url($"_license"), null, _params(requestParameters)); + + ///Represents a DELETE on /_license + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> LicenseDeleteAsync(Func requestParameters = null) + where T : class => this.DoRequestAsync(DELETE, Url($"_license"), null, _params(requestParameters)); + + ///Represents a GET on /_license + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse LicenseGet(Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"_license"), null, _params(requestParameters)); + + ///Represents a GET on /_license + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> LicenseGetAsync(Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"_license"), null, _params(requestParameters)); + + ///Represents a PUT on /_license + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///licenses to be installed + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse LicensePost(PostData body, Func requestParameters = null) + where T : class => this.DoRequest(PUT, Url($"_license"), body, _params(requestParameters)); + + ///Represents a PUT on /_license + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///licenses to be installed + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> LicensePostAsync(PostData body, Func requestParameters = null) + where T : class => this.DoRequestAsync(PUT, Url($"_license"), body, _params(requestParameters)); + + ///Represents a GET on /_shield/authenticate + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve details about the currently authenticated user + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldAuthenticate(Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"_shield/authenticate"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/authenticate + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve details about the currently authenticated user + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldAuthenticateAsync(Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"_shield/authenticate"), null, _params(requestParameters)); + + ///Represents a POST on /_shield/realm/{realms}/_clear_cache + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Clears the internal user caches for specified realms + /// + ///Comma-separated list of realms to clear + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldClearCachedRealms(string realms, Func requestParameters = null) + where T : class => this.DoRequest(POST, Url($"_shield/realm/{realms.NotNull("realms")}/_clear_cache"), null, _params(requestParameters)); + + ///Represents a POST on /_shield/realm/{realms}/_clear_cache + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Clears the internal user caches for specified realms + /// + ///Comma-separated list of realms to clear + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldClearCachedRealmsAsync(string realms, Func requestParameters = null) + where T : class => this.DoRequestAsync(POST, Url($"_shield/realm/{realms.NotNull("realms")}/_clear_cache"), null, _params(requestParameters)); + + ///Represents a POST on /_shield/role/{name}/_clear_cache + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Clears the internal caches for specified roles + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldClearCachedRoles(string name, Func requestParameters = null) + where T : class => this.DoRequest(POST, Url($"_shield/role/{name.NotNull("name")}/_clear_cache"), null, _params(requestParameters)); + + ///Represents a POST on /_shield/role/{name}/_clear_cache + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Clears the internal caches for specified roles + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldClearCachedRolesAsync(string name, Func requestParameters = null) + where T : class => this.DoRequestAsync(POST, Url($"_shield/role/{name.NotNull("name")}/_clear_cache"), null, _params(requestParameters)); + + ///Represents a DELETE on /_shield/role/{name} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Remove a role from the native shield realm + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldDeleteRole(string name, Func requestParameters = null) + where T : class => this.DoRequest(DELETE, Url($"_shield/role/{name.NotNull("name")}"), null, _params(requestParameters)); + + ///Represents a DELETE on /_shield/role/{name} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Remove a role from the native shield realm + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldDeleteRoleAsync(string name, Func requestParameters = null) + where T : class => this.DoRequestAsync(DELETE, Url($"_shield/role/{name.NotNull("name")}"), null, _params(requestParameters)); + + ///Represents a DELETE on /_shield/user/{username} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Remove a user from the native shield realm + /// + ///The username of the User + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldDeleteUser(string username, Func requestParameters = null) + where T : class => this.DoRequest(DELETE, Url($"_shield/user/{username.NotNull("username")}"), null, _params(requestParameters)); + + ///Represents a DELETE on /_shield/user/{username} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Remove a user from the native shield realm + /// + ///The username of the User + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldDeleteUserAsync(string username, Func requestParameters = null) + where T : class => this.DoRequestAsync(DELETE, Url($"_shield/user/{username.NotNull("username")}"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/role/{name} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more roles from the native shield realm + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldGetRole(string name, Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"_shield/role/{name.NotNull("name")}"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/role/{name} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more roles from the native shield realm + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldGetRoleAsync(string name, Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"_shield/role/{name.NotNull("name")}"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/role + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more roles from the native shield realm + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldGetRole(Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"_shield/role"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/role + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more roles from the native shield realm + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldGetRoleAsync(Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"_shield/role"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/user/{username} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more users from the native shield realm + /// + ///A comma-separated list of usernames + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldGetUser(string username, Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"_shield/user/{username.NotNull("username")}"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/user/{username} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more users from the native shield realm + /// + ///A comma-separated list of usernames + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldGetUserAsync(string username, Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"_shield/user/{username.NotNull("username")}"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/user + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more users from the native shield realm + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldGetUser(Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"_shield/user"), null, _params(requestParameters)); + + ///Represents a GET on /_shield/user + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more users from the native shield realm + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldGetUserAsync(Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"_shield/user"), null, _params(requestParameters)); + + ///Represents a PUT on /_shield/role/{name} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a role for the native shield realm + /// + ///Role name + ///The role to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldPutRole(string name, PostData body, Func requestParameters = null) + where T : class => this.DoRequest(PUT, Url($"_shield/role/{name.NotNull("name")}"), body, _params(requestParameters)); + + ///Represents a PUT on /_shield/role/{name} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a role for the native shield realm + /// + ///Role name + ///The role to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldPutRoleAsync(string name, PostData body, Func requestParameters = null) + where T : class => this.DoRequestAsync(PUT, Url($"_shield/role/{name.NotNull("name")}"), body, _params(requestParameters)); + + ///Represents a POST on /_shield/role/{name} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a role for the native shield realm + /// + ///Role name + ///The role to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldPutRolePost(string name, PostData body, Func requestParameters = null) + where T : class => this.DoRequest(POST, Url($"_shield/role/{name.NotNull("name")}"), body, _params(requestParameters)); + + ///Represents a POST on /_shield/role/{name} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a role for the native shield realm + /// + ///Role name + ///The role to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldPutRolePostAsync(string name, PostData body, Func requestParameters = null) + where T : class => this.DoRequestAsync(POST, Url($"_shield/role/{name.NotNull("name")}"), body, _params(requestParameters)); + + ///Represents a PUT on /_shield/user/{username} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a user for the native shield realm + /// + ///The username of the User + ///The user to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldPutUser(string username, PostData body, Func requestParameters = null) + where T : class => this.DoRequest(PUT, Url($"_shield/user/{username.NotNull("username")}"), body, _params(requestParameters)); + + ///Represents a PUT on /_shield/user/{username} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a user for the native shield realm + /// + ///The username of the User + ///The user to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldPutUserAsync(string username, PostData body, Func requestParameters = null) + where T : class => this.DoRequestAsync(PUT, Url($"_shield/user/{username.NotNull("username")}"), body, _params(requestParameters)); + + ///Represents a POST on /_shield/user/{username} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a user for the native shield realm + /// + ///The username of the User + ///The user to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public ElasticsearchResponse ShieldPutUserPost(string username, PostData body, Func requestParameters = null) + where T : class => this.DoRequest(POST, Url($"_shield/user/{username.NotNull("username")}"), body, _params(requestParameters)); + + ///Represents a POST on /_shield/user/{username} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a user for the native shield realm + /// + ///The username of the User + ///The user to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task> ShieldPutUserPostAsync(string username, PostData body, Func requestParameters = null) + where T : class => this.DoRequestAsync(POST, Url($"_shield/user/{username.NotNull("username")}"), body, _params(requestParameters)); + } } diff --git a/src/Elasticsearch.Net/Elasticsearch.Net.csproj b/src/Elasticsearch.Net/Elasticsearch.Net.csproj index 40abe4b68e5..dce8c9777b8 100644 --- a/src/Elasticsearch.Net/Elasticsearch.Net.csproj +++ b/src/Elasticsearch.Net/Elasticsearch.Net.csproj @@ -60,7 +60,7 @@ - + diff --git a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs index 10275be8e2b..bad76411387 100644 --- a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs +++ b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs @@ -7716,5 +7716,531 @@ public partial interface IElasticLowLevelClient ///A func that allows you to describe the querystring parameters & request specific connection settings. Task> DeleteByQueryAsync(string index, string type, PostData body, Func requestParameters = null) where T : class; + ///Represents a GET on /{index}/_graph/explore + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse GraphExploreGet(string index, Func requestParameters = null) where T : class; + + ///Represents a GET on /{index}/_graph/explore + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> GraphExploreGetAsync(string index, Func requestParameters = null) where T : class; + + ///Represents a GET on /{index}/{type}/_graph/explore + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A comma-separated list of document types to search; leave empty to perform the operation on all types + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse GraphExploreGet(string index, string type, Func requestParameters = null) where T : class; + + ///Represents a GET on /{index}/{type}/_graph/explore + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A comma-separated list of document types to search; leave empty to perform the operation on all types + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> GraphExploreGetAsync(string index, string type, Func requestParameters = null) where T : class; + + ///Represents a POST on /{index}/_graph/explore + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///Graph Query DSL + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse GraphExplore(string index, PostData body, Func requestParameters = null) where T : class; + + ///Represents a POST on /{index}/_graph/explore + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///Graph Query DSL + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> GraphExploreAsync(string index, PostData body, Func requestParameters = null) where T : class; + + ///Represents a POST on /{index}/{type}/_graph/explore + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A comma-separated list of document types to search; leave empty to perform the operation on all types + ///Graph Query DSL + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse GraphExplore(string index, string type, PostData body, Func requestParameters = null) where T : class; + + ///Represents a POST on /{index}/{type}/_graph/explore + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/graph/current/explore.html + /// + ///A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + ///A comma-separated list of document types to search; leave empty to perform the operation on all types + ///Graph Query DSL + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> GraphExploreAsync(string index, string type, PostData body, Func requestParameters = null) where T : class; + + ///Represents a DELETE on /_license + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse LicenseDelete(Func requestParameters = null) where T : class; + + ///Represents a DELETE on /_license + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> LicenseDeleteAsync(Func requestParameters = null) where T : class; + + ///Represents a GET on /_license + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse LicenseGet(Func requestParameters = null) where T : class; + + ///Represents a GET on /_license + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> LicenseGetAsync(Func requestParameters = null) where T : class; + + ///Represents a PUT on /_license + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///licenses to be installed + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse LicensePost(PostData body, Func requestParameters = null) where T : class; + + ///Represents a PUT on /_license + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: https://www.elastic.co/guide/en/shield/current/license-management.html + /// + ///licenses to be installed + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> LicensePostAsync(PostData body, Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/authenticate + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve details about the currently authenticated user + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldAuthenticate(Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/authenticate + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve details about the currently authenticated user + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldAuthenticateAsync(Func requestParameters = null) where T : class; + + ///Represents a POST on /_shield/realm/{realms}/_clear_cache + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Clears the internal user caches for specified realms + /// + ///Comma-separated list of realms to clear + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldClearCachedRealms(string realms, Func requestParameters = null) where T : class; + + ///Represents a POST on /_shield/realm/{realms}/_clear_cache + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Clears the internal user caches for specified realms + /// + ///Comma-separated list of realms to clear + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldClearCachedRealmsAsync(string realms, Func requestParameters = null) where T : class; + + ///Represents a POST on /_shield/role/{name}/_clear_cache + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Clears the internal caches for specified roles + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldClearCachedRoles(string name, Func requestParameters = null) where T : class; + + ///Represents a POST on /_shield/role/{name}/_clear_cache + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Clears the internal caches for specified roles + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldClearCachedRolesAsync(string name, Func requestParameters = null) where T : class; + + ///Represents a DELETE on /_shield/role/{name} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Remove a role from the native shield realm + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldDeleteRole(string name, Func requestParameters = null) where T : class; + + ///Represents a DELETE on /_shield/role/{name} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Remove a role from the native shield realm + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldDeleteRoleAsync(string name, Func requestParameters = null) where T : class; + + ///Represents a DELETE on /_shield/user/{username} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Remove a user from the native shield realm + /// + ///The username of the User + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldDeleteUser(string username, Func requestParameters = null) where T : class; + + ///Represents a DELETE on /_shield/user/{username} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Remove a user from the native shield realm + /// + ///The username of the User + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldDeleteUserAsync(string username, Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/role/{name} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more roles from the native shield realm + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldGetRole(string name, Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/role/{name} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more roles from the native shield realm + /// + ///Role name + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldGetRoleAsync(string name, Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/role + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more roles from the native shield realm + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldGetRole(Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/role + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more roles from the native shield realm + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldGetRoleAsync(Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/user/{username} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more users from the native shield realm + /// + ///A comma-separated list of usernames + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldGetUser(string username, Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/user/{username} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more users from the native shield realm + /// + ///A comma-separated list of usernames + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldGetUserAsync(string username, Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/user + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more users from the native shield realm + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldGetUser(Func requestParameters = null) where T : class; + + ///Represents a GET on /_shield/user + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Retrieve one or more users from the native shield realm + /// + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldGetUserAsync(Func requestParameters = null) where T : class; + + ///Represents a PUT on /_shield/role/{name} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a role for the native shield realm + /// + ///Role name + ///The role to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldPutRole(string name, PostData body, Func requestParameters = null) where T : class; + + ///Represents a PUT on /_shield/role/{name} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a role for the native shield realm + /// + ///Role name + ///The role to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldPutRoleAsync(string name, PostData body, Func requestParameters = null) where T : class; + + ///Represents a POST on /_shield/role/{name} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a role for the native shield realm + /// + ///Role name + ///The role to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldPutRolePost(string name, PostData body, Func requestParameters = null) where T : class; + + ///Represents a POST on /_shield/role/{name} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a role for the native shield realm + /// + ///Role name + ///The role to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldPutRolePostAsync(string name, PostData body, Func requestParameters = null) where T : class; + + ///Represents a PUT on /_shield/user/{username} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a user for the native shield realm + /// + ///The username of the User + ///The user to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldPutUser(string username, PostData body, Func requestParameters = null) where T : class; + + ///Represents a PUT on /_shield/user/{username} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a user for the native shield realm + /// + ///The username of the User + ///The user to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldPutUserAsync(string username, PostData body, Func requestParameters = null) where T : class; + + ///Represents a POST on /_shield/user/{username} + ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a user for the native shield realm + /// + ///The username of the User + ///The user to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + ElasticsearchResponse ShieldPutUserPost(string username, PostData body, Func requestParameters = null) where T : class; + + ///Represents a POST on /_shield/user/{username} + ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: + /// - T, an object you own that the elasticsearch response will be deserialized to + /// - byte[], no deserialization, but the response stream will be closed + /// - Stream, no deserialization, response stream is your responsibility + /// - VoidResponse, no deserialization, response stream never read and closed + /// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth + ///See also: Update or create a user for the native shield realm + /// + ///The username of the User + ///The user to add + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task> ShieldPutUserPostAsync(string username, PostData body, Func requestParameters = null) where T : class; + } } \ No newline at end of file diff --git a/src/Elasticsearch.Net/Transport/Pipeline/RequestData.cs b/src/Elasticsearch.Net/Transport/Pipeline/RequestData.cs index 415f39e4cda..9a073612fa9 100644 --- a/src/Elasticsearch.Net/Transport/Pipeline/RequestData.cs +++ b/src/Elasticsearch.Net/Transport/Pipeline/RequestData.cs @@ -28,6 +28,7 @@ public class RequestData public bool Pipelined { get; } public bool HttpCompression { get; } public string ContentType { get; } + public string RunAs { get; } public NameValueCollection Headers { get; } public string ProxyAddress { get; } @@ -41,17 +42,23 @@ public class RequestData public IConnectionConfigurationValues ConnectionSettings { get; } public IMemoryStreamFactory MemoryStreamFactory { get; } + [Obsolete("this constructor is scheduled to be removed in the next major version")] public RequestData(HttpMethod method, string path, PostData data, IConnectionConfigurationValues global, IMemoryStreamFactory memoryStreamFactory) +#pragma warning disable CS0618 // Type or member is obsolete : this(method, path, data, global, (IRequestConfiguration)null, memoryStreamFactory) +#pragma warning restore CS0618 // Type or member is obsolete { } public RequestData(HttpMethod method, string path, PostData data, IConnectionConfigurationValues global, IRequestParameters local, IMemoryStreamFactory memoryStreamFactory) +#pragma warning disable CS0618 // Type or member is obsolete : this(method, path, data, global, (IRequestConfiguration)local?.RequestConfiguration, memoryStreamFactory) +#pragma warning restore CS0618 // Type or member is obsolete { this.CustomConverter = local?.DeserializationOverride; this.Path = this.CreatePathWithQueryStrings(path, this.ConnectionSettings, local); } + [Obsolete("this constructor is scheduled to become private in the next major version")] public RequestData(HttpMethod method, string path, PostData data, IConnectionConfigurationValues global, IRequestConfiguration local, IMemoryStreamFactory memoryStreamFactory) { this.ConnectionSettings = global; @@ -64,9 +71,10 @@ public RequestData(HttpMethod method, string path, PostData data, IConne this.HttpCompression = global.EnableHttpCompression; this.ContentType = local?.ContentType ?? MimeType; this.Headers = global.Headers; + this.RunAs = local?.RunAs; this.RequestTimeout = local?.RequestTimeout ?? global.RequestTimeout; - this.PingTimeout = + this.PingTimeout = local?.PingTimeout ?? global?.PingTimeout ?? (global.ConnectionPool.UsingSsl ? ConnectionConfiguration.DefaultPingTimeoutOnSSL : ConnectionConfiguration.DefaultPingTimeout); @@ -97,25 +105,26 @@ private string CreatePathWithQueryStrings(string path, IConnectionConfigurationV var tempUri = new Uri("http://localhost:9200/" + path).Purify(); if (tempUri.Query.IsNullOrEmpty()) path += queryString; - else + else path += "&" + queryString.Substring(1, queryString.Length - 1); return path; } - protected bool Equals(RequestData other) => - RequestTimeout.Equals(other.RequestTimeout) - && PingTimeout.Equals(other.PingTimeout) - && KeepAliveTime == other.KeepAliveTime - && KeepAliveInterval == other.KeepAliveInterval - && Pipelined == other.Pipelined - && HttpCompression == other.HttpCompression - && Equals(Headers, other.Headers) - && string.Equals(ProxyAddress, other.ProxyAddress) - && string.Equals(ProxyUsername, other.ProxyUsername) - && string.Equals(ProxyPassword, other.ProxyPassword) - && DisableAutomaticProxyDetection == other.DisableAutomaticProxyDetection - && Equals(BasicAuthorizationCredentials, other.BasicAuthorizationCredentials) - && Equals(ConnectionSettings, other.ConnectionSettings) + protected bool Equals(RequestData other) => + RequestTimeout.Equals(other.RequestTimeout) + && PingTimeout.Equals(other.PingTimeout) + && KeepAliveTime == other.KeepAliveTime + && KeepAliveInterval == other.KeepAliveInterval + && Pipelined == other.Pipelined + && HttpCompression == other.HttpCompression + && Equals(Headers, other.Headers) + && string.Equals(RunAs, other.RunAs) + && string.Equals(ProxyAddress, other.ProxyAddress) + && string.Equals(ProxyUsername, other.ProxyUsername) + && string.Equals(ProxyPassword, other.ProxyPassword) + && DisableAutomaticProxyDetection == other.DisableAutomaticProxyDetection + && Equals(BasicAuthorizationCredentials, other.BasicAuthorizationCredentials) + && Equals(ConnectionSettings, other.ConnectionSettings) && Equals(MemoryStreamFactory, other.MemoryStreamFactory); public override bool Equals(object obj) @@ -134,6 +143,7 @@ public override int GetHashCode() hashCode = (hashCode*397) ^ PingTimeout.GetHashCode(); hashCode = (hashCode*397) ^ KeepAliveTime; hashCode = (hashCode*397) ^ KeepAliveInterval; + hashCode = (hashCode*397) ^ (RunAs?.GetHashCode() ?? 0); hashCode = (hashCode*397) ^ Pipelined.GetHashCode(); hashCode = (hashCode*397) ^ HttpCompression.GetHashCode(); hashCode = (hashCode*397) ^ (Headers?.GetHashCode() ?? 0); @@ -149,4 +159,4 @@ public override int GetHashCode() } } -} \ No newline at end of file +} diff --git a/src/Elasticsearch.Net/Transport/Pipeline/RequestPipeline.cs b/src/Elasticsearch.Net/Transport/Pipeline/RequestPipeline.cs index 1a7b5c3476f..0cdf3964bbe 100644 --- a/src/Elasticsearch.Net/Transport/Pipeline/RequestPipeline.cs +++ b/src/Elasticsearch.Net/Transport/Pipeline/RequestPipeline.cs @@ -227,8 +227,10 @@ private RequestData CreatePingRequestData(Node node, Auditable audit) ForceNode = this.RequestConfiguration?.ForceNode, CancellationToken = this.RequestConfiguration?.CancellationToken ?? default(CancellationToken) }; + IRequestParameters requestParameters = new RootNodeInfoRequestParameters { }; + requestParameters.RequestConfiguration = requestOverrides; - return new RequestData(HttpMethod.HEAD, "/", null, this._settings, requestOverrides, this._memoryStreamFactory) { Node = node }; + return new RequestData(HttpMethod.HEAD, "/", null, this._settings, requestParameters, this._memoryStreamFactory) { Node = node }; } public void Ping(Node node) @@ -317,7 +319,7 @@ public void Sniff() audit.Node = node; try { - var requestData = new RequestData(HttpMethod.GET, path, null, this._settings, this._memoryStreamFactory) { Node = node }; + var requestData = new RequestData(HttpMethod.GET, path, null, this._settings, (IRequestParameters)null, this._memoryStreamFactory) { Node = node }; var response = this._connection.Request(requestData); ThrowBadAuthPipelineExceptionWhenNeeded(response); //sniff should not silently accept bad but valid http responses @@ -350,7 +352,7 @@ public async Task SniffAsync() audit.Node = node; try { - var requestData = new RequestData(HttpMethod.GET, path, null, this._settings, this._memoryStreamFactory) { Node = node }; + var requestData = new RequestData(HttpMethod.GET, path, null, this._settings, (IRequestParameters)null, this._memoryStreamFactory) { Node = node }; var response = await this._connection.RequestAsync(requestData).ConfigureAwait(false); ThrowBadAuthPipelineExceptionWhenNeeded(response); //sniff should not silently accept bad but valid http responses diff --git a/src/Nest/Cat/ElasticClient-Cat.cs b/src/Nest/Cat/ElasticClient-Cat.cs index ae72f79b8e9..048f8f27dda 100644 --- a/src/Nest/Cat/ElasticClient-Cat.cs +++ b/src/Nest/Cat/ElasticClient-Cat.cs @@ -22,7 +22,7 @@ Func, ElasticsearchResponse>> dispatch ) where TCatRecord : ICatRecord where TParams : FluentRequestParameters, new() - where TRequest : IRequest => + where TRequest : IRequest => this.Dispatcher.Dispatch>( this.ForceConfiguration(request, c => c.ContentType = "application/json"), new Func>(this.DeserializeCatResponse), @@ -35,12 +35,12 @@ Func, Task>>> di ) where TCatRecord : ICatRecord where TParams : FluentRequestParameters, new() - where TRequest : IRequest => + where TRequest : IRequest => this.Dispatcher.DispatchAsync, ICatResponse>( this.ForceConfiguration(request, c => c.ContentType = "application/json"), new Func>(this.DeserializeCatResponse), (p, d) => dispatch(p) ); - + } -} \ No newline at end of file +} diff --git a/src/Nest/CommonAbstractions/Request/RequestBase.cs b/src/Nest/CommonAbstractions/Request/RequestBase.cs index 1553487be07..abc35747d60 100644 --- a/src/Nest/CommonAbstractions/Request/RequestBase.cs +++ b/src/Nest/CommonAbstractions/Request/RequestBase.cs @@ -11,13 +11,14 @@ public interface IRequest HttpMethod HttpMethod { get; } RouteValues RouteValues { get; } + } public interface IRequest : IRequest where TParameters : IRequestParameters, new() { /// - /// Used to describe request parameters not part of the body. e.q query string or + /// Used to describe request parameters not part of the body. e.q query string or /// connection configuration overrides /// TParameters RequestParameters { get; set; } @@ -37,7 +38,6 @@ protected RequestBase(Func pathSelector) protected virtual HttpMethod HttpMethod => RequestState.RequestParameters.DefaultHttpMethod; - [JsonIgnore] HttpMethod IRequest.HttpMethod => this.HttpMethod; @@ -47,12 +47,29 @@ protected RequestBase(Func pathSelector) [JsonIgnore] TParameters IRequest.RequestParameters { get; set; } = new TParameters(); - protected TOut Q(string name) => RequestState.RequestParameters.GetQueryStringValue(name); protected void Q(string name, object value) => RequestState.RequestParameters.AddQueryStringValue(name, value); + } + public abstract class PlainRequestBase : RequestBase + where TParameters : IRequestParameters, new() + { + protected PlainRequestBase() { } + protected PlainRequestBase(Func pathSelector) : base(pathSelector) { } + + /// + /// Specify settings for this request alone, handy if you need a custom timeout or want to bypass sniffing, retries + /// + public IRequestConfiguration RequestConfiguration + { + get { return RequestState.RequestParameters.RequestConfiguration; } + set { RequestState.RequestParameters.RequestConfiguration = value; } + } + } + + public abstract class RequestDescriptorBase : RequestBase, IDescriptor where TDescriptor : RequestDescriptorBase, TInterface where TParameters : FluentRequestParameters, new() @@ -63,6 +80,7 @@ public abstract class RequestDescriptorBase pathSelector) : base(pathSelector) { _descriptor = (TDescriptor)this; } protected TInterface Self => _descriptor; + protected IRequestConfiguration RequestConfig => ((IRequestParameters)RequestState.RequestParameters).RequestConfiguration; protected TDescriptor Assign(Action assign) => Fluent.Assign(_descriptor, assign); @@ -102,4 +120,4 @@ public TDescriptor RequestConfiguration(Func base.ToString(); } -} \ No newline at end of file +} diff --git a/src/Nest/CommonAbstractions/Request/RouteValues.cs b/src/Nest/CommonAbstractions/Request/RouteValues.cs index f5a94284fb7..1ec991b6395 100644 --- a/src/Nest/CommonAbstractions/Request/RouteValues.cs +++ b/src/Nest/CommonAbstractions/Request/RouteValues.cs @@ -25,6 +25,8 @@ public class RouteValues public string IndexMetric => GetResolved("index_metric"); public string Lang => GetResolved("lang"); public string TaskId => GetResolved("task_id"); + public string Realms => GetResolved("realms"); + public string Username => GetResolved("username"); private string GetResolved(string route) { diff --git a/src/Nest/CommonAbstractions/Response/DictionaryResponseBase.cs b/src/Nest/CommonAbstractions/Response/DictionaryResponseBase.cs index 90b53a87d9d..2c7633fb754 100644 --- a/src/Nest/CommonAbstractions/Response/DictionaryResponseBase.cs +++ b/src/Nest/CommonAbstractions/Response/DictionaryResponseBase.cs @@ -28,7 +28,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist var dict = new Dictionary(); serializer.Populate(reader, dict); response.BackingDictionary = dict; - return response; + return response; } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { } diff --git a/src/Nest/Document/Multiple/UpdateByQuery/ElasticClient-UpdateByQuery.cs b/src/Nest/Document/Multiple/UpdateByQuery/ElasticClient-UpdateByQuery.cs index dcb4b527894..07447b73675 100644 --- a/src/Nest/Document/Multiple/UpdateByQuery/ElasticClient-UpdateByQuery.cs +++ b/src/Nest/Document/Multiple/UpdateByQuery/ElasticClient-UpdateByQuery.cs @@ -37,11 +37,8 @@ public IUpdateByQueryResponse UpdateByQuery(Indices indices, Types types, Fun /// public IUpdateByQueryResponse UpdateByQuery(IUpdateByQueryRequest request) => this.Dispatcher.Dispatch( - request, - (p,d) => { - p.RequestParameters.RequestConfiguration(f => f.AllowedStatusCodes(-1)); - return this.LowLevelDispatch.UpdateByQueryDispatch(p, d); - } + this.ForceConfiguration(request, c => c.AllowedStatusCodes = new[] { -1 }), + this.LowLevelDispatch.UpdateByQueryDispatch ); /// @@ -51,11 +48,8 @@ public Task UpdateByQueryAsync(Indices indices, Types /// public Task UpdateByQueryAsync(IUpdateByQueryRequest request) => this.Dispatcher.DispatchAsync( - request, - (p,d) => { - p.RequestParameters.RequestConfiguration(f => f.AllowedStatusCodes(-1)); - return this.LowLevelDispatch.UpdateByQueryDispatchAsync(p, d); - } + this.ForceConfiguration(request, c => c.AllowedStatusCodes = new[] { -1 }), + this.LowLevelDispatch.UpdateByQueryDispatchAsync ); } } diff --git a/src/Nest/Document/Single/Delete/DeleteRequest.cs b/src/Nest/Document/Single/Delete/DeleteRequest.cs index 417a6e55d91..abade0af129 100644 --- a/src/Nest/Document/Single/Delete/DeleteRequest.cs +++ b/src/Nest/Document/Single/Delete/DeleteRequest.cs @@ -8,10 +8,7 @@ public interface IDeleteRequest : IDeleteRequest where T : class { } public partial class DeleteRequest { } - public partial class DeleteRequest : RequestBase, IDeleteRequest - where T : class - { - } + public partial class DeleteRequest where T : class { } [DescriptorFor("Delete")] public partial class DeleteDescriptor where T : class { } diff --git a/src/Nest/Document/Single/Exists/DocumentExistsRequest.cs b/src/Nest/Document/Single/Exists/DocumentExistsRequest.cs index 8000f589a10..d1bf2ec8764 100644 --- a/src/Nest/Document/Single/Exists/DocumentExistsRequest.cs +++ b/src/Nest/Document/Single/Exists/DocumentExistsRequest.cs @@ -8,10 +8,7 @@ public interface IDocumentExistsRequest : IDocumentExistsRequest where T : cl public partial class DocumentExistsRequest { } - public partial class DocumentExistsRequest : RequestBase, IDocumentExistsRequest - where T : class - { - } + public partial class DocumentExistsRequest where T : class { } [DescriptorFor("Exists")] public partial class DocumentExistsDescriptor where T : class diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index 5368b0aa5fc..288dac43630 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -1185,6 +1185,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1216,6 +1269,7 @@ +