/// <summary> /// Initializes a new instance of the SearchServiceClient class. /// </summary> /// <param name="endpoint"> /// Required. The URI endpoint of the Search Service. This is likely /// to be similar to "https://{search_service}.search.windows.net". /// The URI must use HTTPS. /// </param> /// <param name="credential"> /// Required. The API key credential used to authenticate requests /// against the search service. You need to use an admin key to /// perform any operations on the SearchServiceClient. See /// <see href="https://docs.microsoft.com/azure/search/search-security-api-keys"/> /// for more information about API keys in Azure Cognitive Search. /// </param> /// <param name="options"> /// Client configuration options for connecting to Azure Cognitive /// Search. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown when the <paramref name="endpoint"/> or /// <paramref name="credential"/> is null. /// </exception> /// <exception cref="ArgumentException"> /// Thrown when the <paramref name="endpoint"/> is not using HTTPS. /// </exception> public SearchServiceClient( Uri endpoint, AzureKeyCredential credential, SearchClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); endpoint.AssertHttpsScheme(nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); options ??= new SearchClientOptions(); Endpoint = endpoint; ClientDiagnostics = new ClientDiagnostics(options); Pipeline = options.Build(credential); Version = options.Version; Protocol = new ServiceRestClient( ClientDiagnostics, Pipeline, Endpoint.ToString(), Version.ToVersionString()); }
internal ServiceClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string ApiVersion = "2019-05-06-Preview") { RestClient = new ServiceRestClient(clientDiagnostics, pipeline, endpoint, ApiVersion); this.clientDiagnostics = clientDiagnostics; this.pipeline = pipeline; }