Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sdk/search/azure-search-documents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- Removed `SearchServiceClientBuilder`.
- Renamed `SearchIndexClient` to `SearchClient` and `SearchIndexAsyncClient` to `SearchAsyncClient`.
- Put all models used `SearchIndexClient` and `SearchIndexerClient` (same for async clients) under `com.azure.search.documents.indexes`.
- Removed `SearchIndexerDataSource` to `SearchIndexerDataSourceConnection`,
- Renamed methods on `SearchIndexerClient` and `SearchIndexerAsyncClient` idiomatically matching "DataSource" to "DataSourceConnection".
- Removed `DataSourceCredential` and `AzureActiveDirectoryApplicationCredentials`,
and uplifted the properties to `SearchIndexerDataSourceConnection` and `SearchResourceEncryptionKey` respectively.
- Removed `select` parameter from list service resource APIs.
- Added list names APIs for each search service resource. (e.g. `listSearchIndexNames`, `listSearchIndexerNames`, `listDataSourceNames`, `listSkillsetNames`, `listSynonymMapNames`)

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,75 @@

package com.azure.search.documents.implementation.converters;

import com.azure.search.documents.indexes.implementation.models.DataSourceCredentials;
import com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource;
import com.azure.search.documents.indexes.models.DataChangeDetectionPolicy;
import com.azure.search.documents.indexes.models.DataDeletionDetectionPolicy;
import com.azure.search.documents.indexes.models.DataSourceCredentials;
import com.azure.search.documents.indexes.models.SearchIndexerDataContainer;
import com.azure.search.documents.indexes.models.SearchIndexerDataSource;
import com.azure.search.documents.indexes.models.SearchIndexerDataSourceConnection;
import com.azure.search.documents.indexes.models.SearchIndexerDataSourceType;

/**
* A converter between {@link com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource} and
* {@link SearchIndexerDataSource}.
* A converter between {@link SearchIndexerDataSource} and
* {@link SearchIndexerDataSourceConnection}.
*/
public final class SearchIndexerDataSourceConverter {
/**
* Maps from {@link com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource} to
* {@link SearchIndexerDataSource}.
* Maps from {@link SearchIndexerDataSource} to
* {@link SearchIndexerDataSourceConnection}.
*/
public static SearchIndexerDataSource map(com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource obj) {
public static SearchIndexerDataSourceConnection map(SearchIndexerDataSource obj) {
if (obj == null) {
return null;
}
SearchIndexerDataSource searchIndexerDataSource = new SearchIndexerDataSource();
SearchIndexerDataSourceConnection searchIndexerDataSourceConnection = new SearchIndexerDataSourceConnection();

if (obj.getContainer() != null) {
SearchIndexerDataContainer container = SearchIndexerDataContainerConverter.map(obj.getContainer());
searchIndexerDataSource.setContainer(container);
searchIndexerDataSourceConnection.setContainer(container);
}

if (obj.getDataChangeDetectionPolicy() != null) {
DataChangeDetectionPolicy dataChangeDetectionPolicy =
DataChangeDetectionPolicyConverter.map(obj.getDataChangeDetectionPolicy());
searchIndexerDataSource.setDataChangeDetectionPolicy(dataChangeDetectionPolicy);
searchIndexerDataSourceConnection.setDataChangeDetectionPolicy(dataChangeDetectionPolicy);
}

if (obj.getCredentials() != null) {
DataSourceCredentials credentials = DataSourceCredentialsConverter.map(obj.getCredentials());
searchIndexerDataSource.setCredentials(credentials);
searchIndexerDataSourceConnection.setConnectionString(obj.getCredentials().getConnectionString());
}

String name = obj.getName();
searchIndexerDataSource.setName(name);
searchIndexerDataSourceConnection.setName(name);

String description = obj.getDescription();
searchIndexerDataSource.setDescription(description);
searchIndexerDataSourceConnection.setDescription(description);

if (obj.getDataDeletionDetectionPolicy() != null) {
DataDeletionDetectionPolicy dataDeletionDetectionPolicy =
DataDeletionDetectionPolicyConverter.map(obj.getDataDeletionDetectionPolicy());
searchIndexerDataSource.setDataDeletionDetectionPolicy(dataDeletionDetectionPolicy);
searchIndexerDataSourceConnection.setDataDeletionDetectionPolicy(dataDeletionDetectionPolicy);
}

String eTag = obj.getETag();
searchIndexerDataSource.setETag(eTag);
searchIndexerDataSourceConnection.setETag(eTag);

if (obj.getType() != null) {
SearchIndexerDataSourceType type = SearchIndexerDataSourceTypeConverter.map(obj.getType());
searchIndexerDataSource.setType(type);
searchIndexerDataSourceConnection.setType(type);
}
return searchIndexerDataSource;
return searchIndexerDataSourceConnection;
}

/**
* Maps from {@link SearchIndexerDataSource} to
* {@link com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource}.
* Maps from {@link SearchIndexerDataSourceConnection} to
* {@link SearchIndexerDataSource}.
*/
public static com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource map(SearchIndexerDataSource obj) {
public static SearchIndexerDataSource map(SearchIndexerDataSourceConnection obj) {
if (obj == null) {
return null;
}
com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource searchIndexerDataSource =
new com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource();
SearchIndexerDataSource searchIndexerDataSource =
new SearchIndexerDataSource();

if (obj.getContainer() != null) {
com.azure.search.documents.indexes.implementation.models.SearchIndexerDataContainer container =
Expand All @@ -81,16 +80,14 @@ public static com.azure.search.documents.indexes.implementation.models.SearchInd
}

if (obj.getDataChangeDetectionPolicy() != null) {
com.azure.search.documents.indexes.implementation.models.DataChangeDetectionPolicy dataChangeDetectionPolicy =
DataChangeDetectionPolicyConverter.map(obj.getDataChangeDetectionPolicy());
com.azure.search.documents.indexes.implementation.models.DataChangeDetectionPolicy
dataChangeDetectionPolicy = DataChangeDetectionPolicyConverter.map(obj.getDataChangeDetectionPolicy());
searchIndexerDataSource.setDataChangeDetectionPolicy(dataChangeDetectionPolicy);
}

if (obj.getCredentials() != null) {
com.azure.search.documents.indexes.implementation.models.DataSourceCredentials credentials =
DataSourceCredentialsConverter.map(obj.getCredentials());
searchIndexerDataSource.setCredentials(credentials);
}
DataSourceCredentials credentials = new DataSourceCredentials();
credentials.setConnectionString(obj.getConnectionString());
searchIndexerDataSource.setCredentials(credentials);

String name = obj.getName();
searchIndexerDataSource.setName(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package com.azure.search.documents.implementation.converters;

import com.azure.search.documents.indexes.models.AzureActiveDirectoryApplicationCredentials;
import com.azure.search.documents.indexes.implementation.models.AzureActiveDirectoryApplicationCredentials;
import com.azure.search.documents.indexes.models.SearchResourceEncryptionKey;

/**
Expand All @@ -24,11 +24,8 @@ public static SearchResourceEncryptionKey map(com.azure.search.documents.indexes
String keyVersion = obj.getKeyVersion();
searchResourceEncryptionKey.setKeyVersion(keyVersion);

if (obj.getAccessCredentials() != null) {
AzureActiveDirectoryApplicationCredentials accessCredentials =
AzureActiveDirectoryApplicationCredentialsConverter.map(obj.getAccessCredentials());
searchResourceEncryptionKey.setAccessCredentials(accessCredentials);
}
searchResourceEncryptionKey.setApplicationId(obj.getAccessCredentials().getApplicationId());
searchResourceEncryptionKey.setApplicationSecret(obj.getAccessCredentials().getApplicationSecret());

String keyName = obj.getKeyName();
searchResourceEncryptionKey.setKeyName(keyName);
Expand All @@ -52,10 +49,12 @@ public static com.azure.search.documents.indexes.implementation.models.SearchRes
String keyVersion = obj.getKeyVersion();
searchResourceEncryptionKey.setKeyVersion(keyVersion);

if (obj.getAccessCredentials() != null) {
com.azure.search.documents.indexes.implementation.models.AzureActiveDirectoryApplicationCredentials accessCredentials = AzureActiveDirectoryApplicationCredentialsConverter.map(obj.getAccessCredentials());
searchResourceEncryptionKey.setAccessCredentials(accessCredentials);
}
AzureActiveDirectoryApplicationCredentials accessCredentials =
new AzureActiveDirectoryApplicationCredentials();
accessCredentials.setApplicationId(obj.getApplicationId());
accessCredentials.setApplicationSecret(obj.getApplicationSecret());
searchResourceEncryptionKey.setAccessCredentials(accessCredentials);


String keyName = obj.getKeyName();
searchResourceEncryptionKey.setKeyName(keyName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.azure.search.documents.indexes.models.GetIndexStatisticsResult;
import com.azure.search.documents.indexes.models.SearchIndex;
import com.azure.search.documents.indexes.models.SearchIndexer;
import com.azure.search.documents.indexes.models.SearchIndexerDataSource;
import com.azure.search.documents.indexes.models.SearchIndexerDataSourceConnection;
import com.azure.search.documents.indexes.models.SearchIndexerSkillset;
import com.azure.search.documents.indexes.models.SearchIndexerStatus;
import com.azure.search.documents.indexes.models.ServiceStatistics;
Expand All @@ -46,25 +46,26 @@

public class MappingUtils {

public static Response<SearchIndexerDataSource> mappingExternalDataSource(
public static Response<SearchIndexerDataSourceConnection> mappingExternalDataSource(
Response<com.azure.search.documents.indexes.implementation.models.SearchIndexerDataSource> dataSourceResponse) {
return new SimpleResponse<>(dataSourceResponse,
SearchIndexerDataSourceConverter.map(dataSourceResponse.getValue()));
}

public static PagedResponse<SearchIndexerDataSource> mappingPagingDataSource(
public static PagedResponse<SearchIndexerDataSourceConnection> mappingPagingDataSource(
Response<ListDataSourcesResult> dataSourceResponse) {
List<SearchIndexerDataSource> dataSourceMaps = dataSourceResponse.getValue().getDataSources().stream()
List<SearchIndexerDataSourceConnection> dataSourceMaps = dataSourceResponse.getValue().getDataSources().stream()
.map(SearchIndexerDataSourceConverter::map).collect(toList());
return new PagedResponseBase<HttpHeaders, SearchIndexerDataSource>(
return new PagedResponseBase<HttpHeaders, SearchIndexerDataSourceConnection>(
dataSourceResponse.getRequest(), dataSourceResponse.getStatusCode(), dataSourceResponse.getHeaders(),
dataSourceMaps, null, null);
}

public static PagedResponse<String> mappingPagingDataSourceNames(
Response<ListDataSourcesResult> dataSourceResponse) {
List<String> dataSourceNames = dataSourceResponse.getValue().getDataSources().stream()
.map(SearchIndexerDataSourceConverter::map).map(SearchIndexerDataSource::getName).collect(toList());
.map(SearchIndexerDataSourceConverter::map)
.map(SearchIndexerDataSourceConnection::getName).collect(toList());
return new PagedResponseBase<HttpHeaders, String>(
dataSourceResponse.getRequest(), dataSourceResponse.getStatusCode(), dataSourceResponse.getHeaders(),
dataSourceNames, null, null);
Expand All @@ -79,7 +80,7 @@ public static PagedResponse<SearchIndex> mappingPagingSearchIndex(
searchIndices, null, null);
}

public static PagedResponse<String> mappingPagingSearchIndexNames(Response<ListIndexesResult>
public static PagedResponse<String> mappingPagingSearchIndexNames(Response<ListIndexesResult>
searchIndexResponse) {
List<String> searchIndexNames = searchIndexResponse.getValue().getIndexes().stream()
.map(SearchIndexConverter::map).map(SearchIndex::getName).collect(toList());
Expand Down
Loading