/* SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ /* * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. * * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Net.Security; using System.Security; using System.Security.Cryptography.X509Certificates; using System.Threading; namespace OpenSearch.Net { public interface IConnectionConfigurationValues : IDisposable { /// /// Basic access authorization credentials to specify with all requests. /// /// /// Cannot be used in conjuction with /// BasicAuthenticationCredentials BasicAuthenticationCredentials { get; } /// /// Api Key authorization credentials to specify with all requests. /// /// /// Cannot be used in conjuction with /// ApiKeyAuthenticationCredentials ApiKeyAuthenticationCredentials { get; } /// Provides a semaphoreslim to transport implementations that need to limit access to a resource SemaphoreSlim BootstrapLock { get; } /// /// Use the following certificates to authenticate all HTTP requests. You can also set them on individual /// request using /// X509CertificateCollection ClientCertificates { get; } /// The connection implementation to use when talking with OpenSearch IConnection Connection { get; } /// /// Limits the number of concurrent connections that can be opened to an endpoint. Defaults to 80 (see /// ). /// /// For Desktop CLR, this setting applies to the DefaultConnectionLimit property on the ServicePointManager object when creating /// ServicePoint objects, affecting the default implementation. /// /// /// For Core CLR, this setting applies to the MaxConnectionsPerServer property on the HttpClientHandler instances used by the HttpClient /// inside the default implementation /// /// int ConnectionLimit { get; } /// The connection pool to use when talking with OpenSearch IConnectionPool ConnectionPool { get; } /// /// 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; } /// /// Disabled proxy detection on the webrequest, in some cases this may speed up the first connection /// your appdomain makes, in other cases it will actually increase the time for the first connection. /// No silver bullet! use with care! /// bool DisableAutomaticProxyDetection { get; } /// /// When set to true will disable (de)serializing directly to the request and response stream and return a byte[] /// copy of the raw request and response on OpenSearch calls. Defaults to false /// bool DisableDirectStreaming { get; } bool DisableMetaHeader { get; } /// /// This signals that we do not want to send initial pings to unknown/previously dead nodes /// and just send the call straightaway /// bool DisablePings { get; } /// /// Enable gzip compressed requests and responses, do note that you need to configure OpenSearch to set this /// /// bool EnableHttpCompression { get; } /// /// Try to send these headers for every request /// NameValueCollection Headers { get; } /// /// Whether HTTP pipelining is enabled. The default is true /// bool HttpPipeliningEnabled { get; } /// /// KeepAliveInterval - specifies the interval, in milliseconds, between /// when successive keep-alive packets are sent if no acknowledgement is /// received. /// TimeSpan? KeepAliveInterval { get; } /// /// KeepAliveTime - specifies the timeout, in milliseconds, with no /// activity until the first keep-alive packet is sent. /// TimeSpan? KeepAliveTime { get; } /// /// The maximum amount of time a node is allowed to marked dead /// TimeSpan? MaxDeadTimeout { get; } /// /// When a retryable exception occurs or status code is returned this controls the maximum /// amount of times we should retry the call to OpenSearch /// int? MaxRetries { get; } /// /// Limits the total runtime including retries separately from ///
		/// When not specified defaults to  which itself defaults to 60 seconds
		/// 
///
TimeSpan? MaxRetryTimeout { get; } /// Provides a memory stream factory IMemoryStreamFactory MemoryStreamFactory { get; } /// /// Register a predicate to select which nodes that you want to execute API calls on. Note that sniffing requests omit this predicate and /// always execute on all nodes. /// When using an implementation that supports reseeding of nodes, this will default to omitting cluster_manager only /// node from regular API calls. /// When using static or single node connection pooling it is assumed the list of node you instantiate the client with should be taken /// verbatim. /// Func NodePredicate { get; } /// /// Allows you to register a callback every time a an API call is returned /// Action OnRequestCompleted { get; } /// /// An action to run when the for a request has been /// created. /// Action OnRequestDataCreated { get; } /// /// The timeout in milliseconds to use for ping requests, which are issued to determine whether a node is alive /// TimeSpan? PingTimeout { get; } /// /// Forces all requests to have ?pretty=true, causing OpenSearch to return formatted json. /// Also forces the client to send out formatted json. Defaults to false /// bool PrettyJson { get; } /// /// When set will force all connections through this proxy /// string ProxyAddress { get; } /// /// The password for the proxy, when configured /// SecureString ProxyPassword { get; } /// /// The username for the proxy, when configured /// string ProxyUsername { get; } /// /// Append these query string parameters automatically to every request /// NameValueCollection QueryStringParameters { get; } /// The serializer to use to serialize requests and deserialize responses IOpenSearchSerializer RequestResponseSerializer { get; } /// /// The timeout in milliseconds for each request to OpenSearch /// TimeSpan RequestTimeout { get; } /// /// Register a ServerCertificateValidationCallback per request /// Func ServerCertificateValidationCallback { get; } /// /// Configure the client to skip deserialization of certain status codes e.g: you run OpenSearch behind a proxy that returns an unexpected /// json format /// IReadOnlyCollection SkipDeserializationForStatusCodes { get; } /// /// Force a new sniff for the cluster when the cluster state information is older than /// the specified timespan /// TimeSpan? SniffInformationLifeSpan { get; } /// /// Force a new sniff for the cluster state every time a connection dies /// bool SniffsOnConnectionFault { get; } /// /// Sniff the cluster state immediately on startup /// bool SniffsOnStartup { get; } /// /// Instead of following a c/go like error checking on response.IsValid do throw an exception (except when is false) /// on the client when a call resulted in an exception on either the client or the OpenSearch server. /// Reasons for such exceptions could be search parser errors, index missing exceptions, etc... /// bool ThrowExceptions { get; } OpenSearchUrlFormatter UrlFormatter { get; } /// /// The user agent string to send with requests. Useful for debugging purposes to understand client and framework /// versions that initiate requests to OpenSearch /// string UserAgent { get; } /// /// Allow you to override the status code inspection that sets /// /// Defaults to validating the statusCode is greater or equal to 200 and less then 300 /// /// /// When the request is using 404 is valid out of the box as well /// /// /// NOTE: if a request specifies this takes precedence /// Func StatusCodeToResponseSuccess { get; } /// /// Whether the request should be sent with chunked Transfer-Encoding. /// bool TransferEncodingChunked { get; } /// /// DnsRefreshTimeout for the connections. Defaults to 5 minutes. /// Will create new instances of after this timeout to force DNS updates /// TimeSpan DnsRefreshTimeout { get; } /// /// Enable statistics about TCP connections to be collected when making a request /// bool EnableTcpStats { get; } /// /// Enable statistics about thread pools to be collected when making a request /// bool EnableThreadPoolStats { get; } /// /// Produces the client meta header for a request. /// MetaHeaderProvider MetaHeaderProvider { get; } } }