diff --git a/sdk/search/azure-search/src/main/java/com/azure/search/SearchIndexAsyncClient.java b/sdk/search/azure-search/src/main/java/com/azure/search/SearchIndexAsyncClient.java index ef73d86e63fe4..be272b93e6165 100644 --- a/sdk/search/azure-search/src/main/java/com/azure/search/SearchIndexAsyncClient.java +++ b/sdk/search/azure-search/src/main/java/com/azure/search/SearchIndexAsyncClient.java @@ -62,7 +62,7 @@ public final class SearchIndexAsyncClient { /** * Search REST API Version */ - private final SearchServiceVersion searchServiceVersion; + private final SearchServiceVersion serviceVersion; /** * The endpoint for the Azure Cognitive Search service. @@ -92,20 +92,20 @@ public final class SearchIndexAsyncClient { /** * Package private constructor to be used by {@link SearchIndexClientBuilder} */ - SearchIndexAsyncClient(String endpoint, String indexName, SearchServiceVersion searchServiceVersion, + SearchIndexAsyncClient(String endpoint, String indexName, SearchServiceVersion serviceVersion, HttpPipeline httpPipeline) { SearchServiceUrlParts parts = SearchServiceUrlParser.parseServiceUrlParts(endpoint); this.endpoint = endpoint; this.indexName = indexName; - this.searchServiceVersion = searchServiceVersion; + this.serviceVersion = serviceVersion; this.httpPipeline = httpPipeline; restClient = new SearchIndexRestClientBuilder() .searchServiceName(parts.serviceName) .indexName(indexName) .searchDnsSuffix(parts.dnsSuffix) - .apiVersion(searchServiceVersion.getVersion()) + .apiVersion(serviceVersion.getVersion()) .pipeline(httpPipeline) .serializer(SERIALIZER) .build(); @@ -333,7 +333,7 @@ Mono> deleteDocumentsWithResponse(Iterable doc * @return The version of the Search service the client is using. */ public SearchServiceVersion getServiceVersion() { - return this.searchServiceVersion; + return this.serviceVersion; } /** diff --git a/sdk/search/azure-search/src/main/java/com/azure/search/SearchIndexClientBuilder.java b/sdk/search/azure-search/src/main/java/com/azure/search/SearchIndexClientBuilder.java index 4be3fa36653c6..c4e8af0372898 100644 --- a/sdk/search/azure-search/src/main/java/com/azure/search/SearchIndexClientBuilder.java +++ b/sdk/search/azure-search/src/main/java/com/azure/search/SearchIndexClientBuilder.java @@ -68,7 +68,7 @@ public final class SearchIndexClientBuilder { private final String clientVersion; private SearchApiKeyCredential searchApiKeyCredential; - private SearchServiceVersion searchServiceVersion; + private SearchServiceVersion serviceVersion; private String endpoint; private HttpClient httpClient; private HttpPipeline httpPipeline; @@ -118,9 +118,9 @@ public SearchIndexAsyncClient buildAsyncClient() { Objects.requireNonNull(indexName, "'indexName' cannot be null."); Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - SearchServiceVersion buildVersion = (searchServiceVersion == null) + SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() - : searchServiceVersion; + : serviceVersion; if (httpPipeline != null) { return new SearchIndexAsyncClient(endpoint, indexName, buildVersion, httpPipeline); @@ -300,11 +300,11 @@ public SearchIndexClientBuilder retryPolicy(RetryPolicy retryPolicy) { * If a service version is not provided, {@link SearchServiceVersion#getLatest()} will be used as a default. When * this default is used updating to a newer client library may result in a newer version of the service being used. * - * @param searchServiceVersion The version of the service to be used when making requests. + * @param serviceVersion The version of the service to be used when making requests. * @return The updated SearchIndexClientBuilder object. */ - public SearchIndexClientBuilder searchServiceVersion(SearchServiceVersion searchServiceVersion) { - this.searchServiceVersion = searchServiceVersion; + public SearchIndexClientBuilder serviceVersion(SearchServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; return this; } } diff --git a/sdk/search/azure-search/src/main/java/com/azure/search/SearchServiceAsyncClient.java b/sdk/search/azure-search/src/main/java/com/azure/search/SearchServiceAsyncClient.java index b5f5578e8b6b9..8d217a4e87db2 100644 --- a/sdk/search/azure-search/src/main/java/com/azure/search/SearchServiceAsyncClient.java +++ b/sdk/search/azure-search/src/main/java/com/azure/search/SearchServiceAsyncClient.java @@ -43,7 +43,7 @@ public final class SearchServiceAsyncClient { /** * Search REST API Version */ - private final SearchServiceVersion searchServiceVersion; + private final SearchServiceVersion serviceVersion; /** * The endpoint for the Azure Cognitive Search service. @@ -65,16 +65,16 @@ public final class SearchServiceAsyncClient { */ private final HttpPipeline httpPipeline; - SearchServiceAsyncClient(String endpoint, SearchServiceVersion searchServiceVersion, HttpPipeline httpPipeline) { + SearchServiceAsyncClient(String endpoint, SearchServiceVersion serviceVersion, HttpPipeline httpPipeline) { SearchServiceUrlParts parts = SearchServiceUrlParser.parseServiceUrlParts(endpoint); this.endpoint = endpoint; - this.searchServiceVersion = searchServiceVersion; + this.serviceVersion = serviceVersion; this.httpPipeline = httpPipeline; this.restClient = new SearchServiceRestClientBuilder() .searchServiceName(parts.serviceName) .searchDnsSuffix(parts.dnsSuffix) - .apiVersion(searchServiceVersion.getVersion()) + .apiVersion(serviceVersion.getVersion()) .pipeline(httpPipeline) .build(); } @@ -96,7 +96,7 @@ HttpPipeline getHttpPipeline() { * @return a {@link SearchIndexAsyncClient} created from the service client configuration */ public SearchIndexAsyncClient getIndexClient(String indexName) { - return new SearchIndexAsyncClient(endpoint, indexName, searchServiceVersion, httpPipeline); + return new SearchIndexAsyncClient(endpoint, indexName, serviceVersion, httpPipeline); } /** @@ -105,7 +105,7 @@ public SearchIndexAsyncClient getIndexClient(String indexName) { * @return the search service version value. */ public SearchServiceVersion getServiceVersion() { - return this.searchServiceVersion; + return this.serviceVersion; } /** diff --git a/sdk/search/azure-search/src/main/java/com/azure/search/SearchServiceClientBuilder.java b/sdk/search/azure-search/src/main/java/com/azure/search/SearchServiceClientBuilder.java index 9467c20067e07..7b9e515ece302 100644 --- a/sdk/search/azure-search/src/main/java/com/azure/search/SearchServiceClientBuilder.java +++ b/sdk/search/azure-search/src/main/java/com/azure/search/SearchServiceClientBuilder.java @@ -66,7 +66,7 @@ public final class SearchServiceClientBuilder { private final String clientVersion; private SearchApiKeyCredential searchApiKeyCredential; - private SearchServiceVersion searchServiceVersion; + private SearchServiceVersion serviceVersion; private String endpoint; private HttpClient httpClient; private HttpPipeline httpPipeline; @@ -112,9 +112,9 @@ public SearchServiceClient buildClient() { public SearchServiceAsyncClient buildAsyncClient() { Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - SearchServiceVersion buildVersion = (searchServiceVersion == null) + SearchServiceVersion buildVersion = (serviceVersion == null) ? SearchServiceVersion.getLatest() - : searchServiceVersion; + : serviceVersion; if (httpPipeline != null) { return new SearchServiceAsyncClient(endpoint, buildVersion, httpPipeline); @@ -279,11 +279,11 @@ public SearchServiceClientBuilder retryPolicy(RetryPolicy retryPolicy) { * If a service version is not provided, {@link SearchServiceVersion#getLatest()} will be used as a default. When * this default is used updating to a newer client library may result in a newer version of the service being used. * - * @param searchServiceVersion The version of the service to be used when making requests. + * @param serviceVersion The version of the service to be used when making requests. * @return The updated SearchServiceClientBuilder object. */ - public SearchServiceClientBuilder searchServiceVersion(SearchServiceVersion searchServiceVersion) { - this.searchServiceVersion = searchServiceVersion; + public SearchServiceClientBuilder serviceVersion(SearchServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; return this; } } diff --git a/sdk/search/azure-search/src/samples/java/com/azure/search/IndexClientConfigurationExample.java b/sdk/search/azure-search/src/samples/java/com/azure/search/IndexClientConfigurationExample.java index f19a3b07a64b3..4a54a31b6ebba 100644 --- a/sdk/search/azure-search/src/samples/java/com/azure/search/IndexClientConfigurationExample.java +++ b/sdk/search/azure-search/src/samples/java/com/azure/search/IndexClientConfigurationExample.java @@ -49,7 +49,7 @@ private static SearchIndexAsyncClient createAdvancedClient() { .endpoint(ENDPOINT) .credential(new SearchApiKeyCredential(API_KEY)) .indexName("hotels") - .searchServiceVersion(SearchServiceVersion.V2019_05_06) + .serviceVersion(SearchServiceVersion.V2019_05_06) .addPolicy(new RetryPolicy()) .httpClient( new NettyAsyncHttpClientBuilder() diff --git a/sdk/search/azure-search/src/test/java/com/azure/search/SearchIndexClientBuilderTests.java b/sdk/search/azure-search/src/test/java/com/azure/search/SearchIndexClientBuilderTests.java index e0f4e821acb31..576fa6528b2a4 100644 --- a/sdk/search/azure-search/src/test/java/com/azure/search/SearchIndexClientBuilderTests.java +++ b/sdk/search/azure-search/src/test/java/com/azure/search/SearchIndexClientBuilderTests.java @@ -21,7 +21,7 @@ public void buildSyncClientTest() { .endpoint(searchEndpoint) .credential(searchApiKeyCredential) .indexName(indexName) - .searchServiceVersion(apiVersion) + .serviceVersion(apiVersion) .buildClient(); assertNotNull(client); @@ -46,7 +46,7 @@ public void buildAsyncClientTest() { .endpoint(searchEndpoint) .credential(searchApiKeyCredential) .indexName(indexName) - .searchServiceVersion(apiVersion) + .serviceVersion(apiVersion) .buildAsyncClient(); assertNotNull(client); @@ -73,7 +73,7 @@ public void whenApiVersionSpecifiedThenSpecifiedValueExists() { .endpoint(searchEndpoint) .credential(searchApiKeyCredential) .indexName(indexName) - .searchServiceVersion(expectedVersion) + .serviceVersion(expectedVersion) .buildClient(); assertEquals(expectedVersion, searchIndexClient.getServiceVersion()); @@ -82,7 +82,7 @@ public void whenApiVersionSpecifiedThenSpecifiedValueExists() { .endpoint(searchEndpoint) .credential(searchApiKeyCredential) .indexName(indexName) - .searchServiceVersion(expectedVersion) + .serviceVersion(expectedVersion) .buildAsyncClient(); assertEquals(expectedVersion, asyncClient.getServiceVersion()); } @@ -161,7 +161,7 @@ public void nullApiVersionUsesLatest() { .endpoint(searchEndpoint) .credential(searchApiKeyCredential) .indexName(indexName) - .searchServiceVersion(null); + .serviceVersion(null); assertEquals(SearchServiceVersion.getLatest(), builder.buildAsyncClient().getServiceVersion()); assertEquals(SearchServiceVersion.getLatest(), builder.buildClient().getServiceVersion()); diff --git a/sdk/search/azure-search/src/test/java/com/azure/search/SearchServiceClientBuilderTests.java b/sdk/search/azure-search/src/test/java/com/azure/search/SearchServiceClientBuilderTests.java index a40ff6ff73a60..1985a5a26b98c 100644 --- a/sdk/search/azure-search/src/test/java/com/azure/search/SearchServiceClientBuilderTests.java +++ b/sdk/search/azure-search/src/test/java/com/azure/search/SearchServiceClientBuilderTests.java @@ -18,7 +18,7 @@ public void buildSyncClientTest() { SearchServiceClient client = new SearchServiceClientBuilder() .endpoint(searchEndpoint) .credential(searchApiKeyCredential) - .searchServiceVersion(apiVersion) + .serviceVersion(apiVersion) .buildClient(); assertNotNull(client); @@ -41,7 +41,7 @@ public void buildAsyncClientTest() { SearchServiceAsyncClient client = new SearchServiceClientBuilder() .endpoint(searchEndpoint) .credential(searchApiKeyCredential) - .searchServiceVersion(apiVersion) + .serviceVersion(apiVersion) .buildAsyncClient(); assertNotNull(client); @@ -66,7 +66,7 @@ public void whenApiVersionSpecifiedThenSpecifiedValueExists() { SearchServiceClient client = new SearchServiceClientBuilder() .endpoint(searchEndpoint) .credential(searchApiKeyCredential) - .searchServiceVersion(expectedApiVersion) + .serviceVersion(expectedApiVersion) .buildClient(); assertEquals(expectedApiVersion.getVersion(), client.getServiceVersion().getVersion()); @@ -74,7 +74,7 @@ public void whenApiVersionSpecifiedThenSpecifiedValueExists() { SearchServiceAsyncClient asyncClient = new SearchServiceClientBuilder() .endpoint(searchEndpoint) .credential(searchApiKeyCredential) - .searchServiceVersion(expectedApiVersion) + .serviceVersion(expectedApiVersion) .buildAsyncClient(); assertEquals(expectedApiVersion.getVersion(), asyncClient.getServiceVersion().getVersion()); } @@ -92,7 +92,7 @@ public void whenBuildClientAndVerifyPropertiesThenSuccess() { SearchServiceAsyncClient asyncClient = new SearchServiceClientBuilder() .endpoint(searchEndpoint) .credential(searchApiKeyCredential) - .searchServiceVersion(apiVersion) + .serviceVersion(apiVersion) .buildAsyncClient(); assertEquals(searchEndpoint, asyncClient.getEndpoint()); @@ -120,7 +120,7 @@ void nullApiVersionSetsLatest() { SearchServiceClientBuilder builder = new SearchServiceClientBuilder() .endpoint(searchEndpoint) .credential(searchApiKeyCredential) - .searchServiceVersion(null); + .serviceVersion(null); assertEquals(SearchServiceVersion.getLatest(), builder.buildAsyncClient().getServiceVersion()); assertEquals(SearchServiceVersion.getLatest(), builder.buildClient().getServiceVersion());