private NodePool CreateNodePool()

in src/Elastic.CommonSchema.BenchmarkDotNetExporter/ElasticsearchBenchmarkExporterOptions.cs [119:145]


		private NodePool CreateNodePool()
		{
			if (!string.IsNullOrWhiteSpace(CloudId))
			{
				if (!string.IsNullOrWhiteSpace(ApiKey))
					return new CloudNodePool(CloudId, new ApiKey(ApiKey));
				if (!string.IsNullOrWhiteSpace(Username) && !string.IsNullOrWhiteSpace(Password))
					return new CloudNodePool(CloudId, new BasicAuthentication(Username, Password));

				throw new Exception("A cloud id was provided but neither apikey nor username/pass combination was set");
			}

			var uris = Nodes;
			if ((uris?.Length ?? 0) == 0)
				return new SingleNodePool(new Uri("http://localhost:9200"));

			if (uris.Length == 1)
			{
				return UseSniffingNodePool
					? new SniffingNodePool(uris)
					: new SingleNodePool(uris[0]);
			}

			return UseSniffingNodePool
				? new SniffingNodePool(uris)
				: new StaticNodePool(uris);
		}