|
| 1 | +// Licensed to Elasticsearch B.V under one or more agreements. |
| 2 | +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. |
| 3 | +// See the LICENSE file in the project root for more information |
| 4 | + |
| 5 | +using System; |
| 6 | +using System.Collections.Generic; |
| 7 | +using System.Collections.Specialized; |
| 8 | +using System.Security.Cryptography.X509Certificates; |
| 9 | + |
| 10 | +namespace Elastic.Transport; |
| 11 | + |
| 12 | +/// <summary> |
| 13 | +/// Allows you to inject per request overrides to the current <see cref="ITransportConfiguration"/>. |
| 14 | +/// </summary> |
| 15 | +public interface IRequestConfiguration |
| 16 | +{ |
| 17 | + /// <summary> |
| 18 | + /// Force a different Accept header on the request |
| 19 | + /// </summary> |
| 20 | + string? Accept { get; } |
| 21 | + |
| 22 | + /// <summary> |
| 23 | + /// Treat the following statuses (on top of the 200 range) NOT as error. |
| 24 | + /// </summary> |
| 25 | + IReadOnlyCollection<int>? AllowedStatusCodes { get; } |
| 26 | + |
| 27 | + /// <summary> Provide an authentication header override for this request </summary> |
| 28 | + AuthorizationHeader? Authentication { get; } |
| 29 | + |
| 30 | + /// <summary> |
| 31 | + /// Use the following client certificates to authenticate this single request |
| 32 | + /// </summary> |
| 33 | + X509CertificateCollection? ClientCertificates { get; } |
| 34 | + |
| 35 | + /// <summary> |
| 36 | + /// Force a different Content-Type header on the request |
| 37 | + /// </summary> |
| 38 | + string? ContentType { get; } |
| 39 | + |
| 40 | + /// <summary> |
| 41 | + /// Whether to buffer the request and response bytes for the call |
| 42 | + /// </summary> |
| 43 | + bool? DisableDirectStreaming { get; } |
| 44 | + |
| 45 | + /// <summary> |
| 46 | + /// Whether to disable the audit trail for the request. |
| 47 | + /// </summary> |
| 48 | + bool? DisableAuditTrail { get; } |
| 49 | + |
| 50 | + /// <summary> |
| 51 | + /// Under no circumstance do a ping before the actual call. If a node was previously dead a small ping with |
| 52 | + /// low connect timeout will be tried first in normal circumstances |
| 53 | + /// </summary> |
| 54 | + bool? DisablePings { get; } |
| 55 | + |
| 56 | + /// <summary> |
| 57 | + /// Forces no sniffing to occur on the request no matter what configuration is in place |
| 58 | + /// globally |
| 59 | + /// </summary> |
| 60 | + bool? DisableSniff { get; } |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// Whether or not this request should be pipelined. http://en.wikipedia.org/wiki/HTTP_pipelining defaults to true |
| 64 | + /// </summary> |
| 65 | + bool? HttpPipeliningEnabled { get; } |
| 66 | + |
| 67 | + /// <summary> |
| 68 | + /// Enable gzip compressed requests and responses |
| 69 | + /// </summary> |
| 70 | + bool? EnableHttpCompression { get; } |
| 71 | + |
| 72 | + /// <summary> |
| 73 | + /// This will force the operation on the specified node, this will bypass any configured connection pool and will no retry. |
| 74 | + /// </summary> |
| 75 | + Uri? ForceNode { get; } |
| 76 | + |
| 77 | + /// <summary> |
| 78 | + /// When a retryable exception occurs or status code is returned this controls the maximum |
| 79 | + /// amount of times we should retry the call to Elasticsearch |
| 80 | + /// </summary> |
| 81 | + int? MaxRetries { get; } |
| 82 | + |
| 83 | + /// <summary> |
| 84 | + /// Limits the total runtime including retries separately from <see cref="IRequestConfiguration.RequestTimeout" /> |
| 85 | + /// <pre> |
| 86 | + /// When not specified defaults to <see cref="IRequestConfiguration.RequestTimeout" /> which itself defaults to 60 seconds |
| 87 | + /// </pre> |
| 88 | + /// </summary> |
| 89 | + TimeSpan? MaxRetryTimeout { get; } |
| 90 | + |
| 91 | + /// <summary> |
| 92 | + /// Associate an Id with this user-initiated task, such that it can be located in the cluster task list. |
| 93 | + /// Valid only for Elasticsearch 6.2.0+ |
| 94 | + /// </summary> |
| 95 | + string? OpaqueId { get; } |
| 96 | + |
| 97 | + /// <summary> Determines whether to parse all HTTP headers in the request. </summary> |
| 98 | + bool? ParseAllHeaders { get; } |
| 99 | + |
| 100 | + /// <summary> |
| 101 | + /// The ping timeout for this specific request |
| 102 | + /// </summary> |
| 103 | + TimeSpan? PingTimeout { get; } |
| 104 | + |
| 105 | + /// <summary> |
| 106 | + /// The timeout for this specific request, takes precedence over the global timeout init |
| 107 | + /// </summary> |
| 108 | + TimeSpan? RequestTimeout { get; } |
| 109 | + |
| 110 | + /// <summary> |
| 111 | + /// Additional response builders to apply. |
| 112 | + /// </summary> |
| 113 | + IReadOnlyCollection<IResponseBuilder> ResponseBuilders { get; } |
| 114 | + |
| 115 | + /// <summary> Specifies the headers from the response that should be parsed. </summary> |
| 116 | + HeadersList? ResponseHeadersToParse { get; } |
| 117 | + |
| 118 | + /// <summary> |
| 119 | + /// Submit the request on behalf in the context of a different shield user |
| 120 | + /// <pre />https://www.elastic.co/guide/en/shield/current/submitting-requests-for-other-users.html |
| 121 | + /// </summary> |
| 122 | + string? RunAs { get; } |
| 123 | + |
| 124 | + /// <summary> |
| 125 | + /// Instead of following a c/go like error checking on response.IsValid do throw an exception (except when <see cref="ApiCallDetails.SuccessOrKnownError"/> is false) |
| 126 | + /// on the client when a call resulted in an exception on either the client or the Elasticsearch server. |
| 127 | + /// <para>Reasons for such exceptions could be search parser errors, index missing exceptions, etc...</para> |
| 128 | + /// </summary> |
| 129 | + bool? ThrowExceptions { get; } |
| 130 | + |
| 131 | + /// <summary> |
| 132 | + /// Whether the request should be sent with chunked Transfer-Encoding. |
| 133 | + /// </summary> |
| 134 | + bool? TransferEncodingChunked { get; } |
| 135 | + |
| 136 | + /// <summary> |
| 137 | + /// Try to send these headers for this single request |
| 138 | + /// </summary> |
| 139 | + NameValueCollection? Headers { get; } |
| 140 | + |
| 141 | + /// <summary> |
| 142 | + /// Enable statistics about TCP connections to be collected when making a request |
| 143 | + /// </summary> |
| 144 | + bool? EnableTcpStats { get; } |
| 145 | + |
| 146 | + /// <summary> |
| 147 | + /// Enable statistics about thread pools to be collected when making a request |
| 148 | + /// </summary> |
| 149 | + bool? EnableThreadPoolStats { get; } |
| 150 | + |
| 151 | + /// <summary> |
| 152 | + /// Holds additional meta data about the request. |
| 153 | + /// </summary> |
| 154 | + RequestMetaData? RequestMetaData { get; } |
| 155 | +} |
0 commit comments