diff --git a/sdk/search/azure-search-documents/azure/search/documents/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/__init__.py index 4daaa371f2f7..75893973ec59 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/__init__.py @@ -72,6 +72,7 @@ GetIndexStatisticsResult, ImageAnalysisSkill, Index, + Indexer, InputFieldMappingEntry, KeepTokenFilter, KeyPhraseExtractionSkill, @@ -163,6 +164,7 @@ "GetIndexStatisticsResult", "ImageAnalysisSkill", "Index", + "Indexer", "IndexAction", "IndexDocumentsBatch", "IndexingResult", diff --git a/sdk/search/azure-search-documents/azure/search/documents/_service/_indexers_client.py b/sdk/search/azure-search-documents/azure/search/documents/_service/_indexers_client.py new file mode 100644 index 000000000000..0d6a6259f4fd --- /dev/null +++ b/sdk/search/azure-search-documents/azure/search/documents/_service/_indexers_client.py @@ -0,0 +1,256 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from azure.core import MatchConditions +from azure.core.tracing.decorator import distributed_trace + +from ._generated import SearchServiceClient as _SearchServiceClient +from ._utils import get_access_conditions +from .._headers_mixin import HeadersMixin +from .._version import SDK_MONIKER + +if TYPE_CHECKING: + # pylint:disable=unused-import,ungrouped-imports + from ._generated.models import Indexer, IndexerExecutionInfo + from typing import Any, Dict, Optional, Sequence + from azure.core.credentials import AzureKeyCredential + + +class SearchIndexersClient(HeadersMixin): + """A client to interact with Azure search service Indexers. + + This class is not normally instantiated directly, instead use + `get_indexers_client()` from a `SearchServiceClient` + + """ + + _ODATA_ACCEPT = "application/json;odata.metadata=minimal" # type: str + + def __init__(self, endpoint, credential, **kwargs): + # type: (str, AzureKeyCredential, **Any) -> None + + self._endpoint = endpoint # type: str + self._credential = credential # type: AzureKeyCredential + self._client = _SearchServiceClient( + endpoint=endpoint, sdk_moniker=SDK_MONIKER, **kwargs + ) # type: _SearchServiceClient + + def __enter__(self): + # type: () -> SearchIndexersClient + self._client.__enter__() # pylint:disable=no-member + return self + + def __exit__(self, *args): + # type: (*Any) -> None + return self._client.__exit__(*args) # pylint:disable=no-member + + def close(self): + # type: () -> None + """Close the :class:`~azure.search.documents.SearchIndexersClient` session. + + """ + return self._client.close() + + @distributed_trace + def create_indexer(self, indexer, **kwargs): + # type: (Indexer, **Any) -> Indexer + """Creates a new Indexers. + + :param indexer: The definition of the indexer to create. + :type indexer: ~~azure.search.documents.Indexer + :return: The created Indexer + :rtype: ~azure.search.documents.Indexer + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_indexer_operations.py + :start-after: [START create_indexer] + :end-before: [END create_indexer] + :language: python + :dedent: 4 + :caption: Create an Indexer + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + result = self._client.indexers.create(indexer, **kwargs) + return result + + @distributed_trace + def create_or_update_indexer(self, indexer, name=None, **kwargs): + # type: (Indexer, Optional[str], **Any) -> Indexer + """Creates a new indexer or updates a indexer if it already exists. + + :param name: The name of the indexer to create or update. + :type name: str + :param indexer: The definition of the indexer to create or update. + :type indexer: ~azure.search.documents.Indexer + :return: The created Indexer + :rtype: ~azure.search.documents.Indexer + """ + error_map, access_condition = get_access_conditions( + indexer, + kwargs.pop('match_condition', MatchConditions.Unconditionally) + ) + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + + if not name: + name = indexer.name + result = self._client.indexers.create_or_update( + indexer_name=name, + indexer=indexer, + access_condition=access_condition, + error_map=error_map, + **kwargs + ) + return result + + @distributed_trace + def get_indexer(self, name, **kwargs): + # type: (str, **Any) -> Indexer + """Retrieves a indexer definition. + + :param name: The name of the indexer to retrieve. + :type name: str + :return: The Indexer that is fetched. + :rtype: ~azure.search.documents.Indexer + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_indexer_operations.py + :start-after: [START get_indexer] + :end-before: [END get_indexer] + :language: python + :dedent: 4 + :caption: Retrieve an Indexer + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + result = self._client.indexers.get(name, **kwargs) + return result + + @distributed_trace + def get_indexers(self, **kwargs): + # type: (**Any) -> Sequence[Indexer] + """Lists all indexers available for a search service. + + :return: List of all the Indexers. + :rtype: `list[dict]` + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_indexer_operations.py + :start-after: [START list_indexer] + :end-before: [END list_indexer] + :language: python + :dedent: 4 + :caption: List all the Indexers + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + result = self._client.indexers.list(**kwargs) + return result.indexers + + @distributed_trace + def delete_indexer(self, indexer, **kwargs): + # type: (Union[str, Indexer], **Any) -> None + """Deletes an indexer. To use access conditions, the Indexer model + must be provided instead of the name. It is enough to provide + the name of the indexer to delete unconditionally. + + :param indexer: The indexer to delete. + :type indexer: str or ~azure.search.documents.Indexer + :keyword match_condition: The match condition to use upon the etag + :type match_condition: ~azure.core.MatchConditions + + :return: None + :rtype: None + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_indexer_operations.py + :start-after: [START delete_indexer] + :end-before: [END delete_indexer] + :language: python + :dedent: 4 + :caption: Delete an Indexer + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + error_map, access_condition = get_access_conditions( + indexer, + kwargs.pop('match_condition', MatchConditions.Unconditionally) + ) + try: + name = indexer.name + except AttributeError: + name = indexer + self._client.indexers.delete(name, access_condition=access_condition, error_map=error_map, **kwargs) + + @distributed_trace + def run_indexer(self, name, **kwargs): + # type: (str, **Any) -> None + """Run an indexer. + + :param name: The name of the indexer to run. + :type name: str + + :return: None + :rtype: None + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_indexer_operations.py + :start-after: [START run_indexer] + :end-before: [END run_indexer] + :language: python + :dedent: 4 + :caption: Run an Indexer + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + self._client.indexers.run(name, **kwargs) + + @distributed_trace + def reset_indexer(self, name, **kwargs): + # type: (str, **Any) -> None + """Resets the change tracking state associated with an indexer. + + :param name: The name of the indexer to reset. + :type name: str + + :return: None + :rtype: None + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_indexer_operations.py + :start-after: [START reset_indexer] + :end-before: [END reset_indexer] + :language: python + :dedent: 4 + :caption: Reset an Indexer's change tracking state + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + self._client.indexers.reset(name, **kwargs) + + @distributed_trace + def get_indexer_status(self, name, **kwargs): + # type: (str, **Any) -> IndexerExecutionInfo + """Get the status of the indexer. + + :param name: The name of the indexer to fetch the status. + :type name: str + + :return: IndexerExecutionInfo + :rtype: IndexerExecutionInfo + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_indexer_operations.py + :start-after: [START get_indexer_status] + :end-before: [END get_indexer_status] + :language: python + :dedent: 4 + :caption: Get an Indexer's status + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + return self._client.indexers.get_status(name, **kwargs) diff --git a/sdk/search/azure-search-documents/azure/search/documents/_service/_search_service_client.py b/sdk/search/azure-search-documents/azure/search/documents/_service/_search_service_client.py index e632088fe13e..9c5205d3dd6b 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_service/_search_service_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_service/_search_service_client.py @@ -12,6 +12,7 @@ from .._version import SDK_MONIKER from ._datasources_client import SearchDataSourcesClient from ._indexes_client import SearchIndexesClient +from ._indexers_client import SearchIndexersClient from ._skillsets_client import SearchSkillsetsClient from ._synonym_maps_client import SearchSynonymMapsClient @@ -62,6 +63,8 @@ def __init__(self, endpoint, credential, **kwargs): endpoint, credential, **kwargs ) + self._indexers_client = SearchIndexersClient(endpoint, credential, **kwargs) + def __repr__(self): # type: () -> str return "".format(repr(self._endpoint))[:1024] @@ -127,3 +130,12 @@ def get_datasources_client(self): :rtype: SearchDataSourcesClient """ return self._datasources_client + + def get_indexers_client(self): + # type: () -> SearchIndexersClient + """Return a client to perform operations on Data Sources. + + :return: The Data Sources client + :rtype: SearchDataSourcesClient + """ + return self._indexers_client diff --git a/sdk/search/azure-search-documents/azure/search/documents/_service/aio/_indexers_client.py b/sdk/search/azure-search-documents/azure/search/documents/_service/aio/_indexers_client.py new file mode 100644 index 000000000000..c17509beaf96 --- /dev/null +++ b/sdk/search/azure-search-documents/azure/search/documents/_service/aio/_indexers_client.py @@ -0,0 +1,256 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from azure.core import MatchConditions +from azure.core.tracing.decorator_async import distributed_trace_async + +from .._generated.aio import SearchServiceClient as _SearchServiceClient +from .._utils import get_access_conditions +from ..._headers_mixin import HeadersMixin +from ..._version import SDK_MONIKER + +if TYPE_CHECKING: + # pylint:disable=unused-import,ungrouped-imports + from .._generated.models import Indexer, IndexerExecutionInfo + from typing import Any, Dict, Optional, Sequence + from azure.core.credentials import AzureKeyCredential + + +class SearchIndexersClient(HeadersMixin): + """A client to interact with Azure search service Indexers. + + This class is not normally instantiated directly, instead use + `get_indexers_client()` from a `SearchServiceClient` + + """ + + _ODATA_ACCEPT = "application/json;odata.metadata=minimal" # type: str + + def __init__(self, endpoint, credential, **kwargs): + # type: (str, AzureKeyCredential, **Any) -> None + + self._endpoint = endpoint # type: str + self._credential = credential # type: AzureKeyCredential + self._client = _SearchServiceClient( + endpoint=endpoint, sdk_moniker=SDK_MONIKER, **kwargs + ) # type: _SearchServiceClient + + def __enter__(self): + # type: () -> SearchIndexersClient + self._client.__enter__() # pylint:disable=no-member + return self + + def __exit__(self, *args): + # type: (*Any) -> None + return self._client.__exit__(*args) # pylint:disable=no-member + + def close(self): + # type: () -> None + """Close the :class:`~azure.search.documents.SearchIndexersClient` session. + + """ + return self._client.close() + + @distributed_trace_async + async def create_indexer(self, indexer, **kwargs): + # type: (Indexer, **Any) -> Indexer + """Creates a new Indexers. + + :param indexer: The definition of the indexer to create. + :type indexer: ~azure.search.documents.Indexer + :return: The created Indexer + :rtype: dict + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_indexer_operations_async.py + :start-after: [START create_indexer_async] + :end-before: [END create_indexer_async] + :language: python + :dedent: 4 + :caption: Create an Indexer + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + result = await self._client.indexers.create(indexer, **kwargs) + return result + + @distributed_trace_async + async def create_or_update_indexer(self, indexer, name=None, **kwargs): + # type: (Indexer, Optional[str], **Any) -> Indexer + """Creates a new indexer or updates a indexer if it already exists. + + :param name: The name of the indexer to create or update. + :type name: str + :param indexer: The definition of the indexer to create or update. + :type indexer: ~azure.search.documents.Indexer + :return: The created Indexer + :rtype: dict + """ + error_map, access_condition = get_access_conditions( + indexer, + kwargs.pop('match_condition', MatchConditions.Unconditionally) + ) + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + + if not name: + name = indexer.name + result = await self._client.indexers.create_or_update( + indexer_name=name, + indexer=indexer, + access_condition=access_condition, + error_map=error_map, + **kwargs + ) + return result + + @distributed_trace_async + async def get_indexer(self, name, **kwargs): + # type: (str, **Any) -> Indexer + """Retrieves a indexer definition. + + :param name: The name of the indexer to retrieve. + :type name: str + :return: The Indexer that is fetched. + :rtype: dict + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_indexer_operations_async.py + :start-after: [START get_indexer_async] + :end-before: [END get_indexer_async] + :language: python + :dedent: 4 + :caption: Retrieve an Indexer + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + result = await self._client.indexers.get(name, **kwargs) + return result + + @distributed_trace_async + async def get_indexers(self, **kwargs): + # type: (**Any) -> Sequence[Indexer] + """Lists all indexers available for a search service. + + :return: List of all the Indexers. + :rtype: `list[dict]` + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_indexer_operations_async.py + :start-after: [START list_indexer_async] + :end-before: [END list_indexer_async] + :language: python + :dedent: 4 + :caption: List all the Indexers + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + result = await self._client.indexers.list(**kwargs) + return result.indexers + + @distributed_trace_async + async def delete_indexer(self, indexer, **kwargs): + # type: (Union[str, Indexer], **Any) -> None + """Deletes an indexer. To use access conditions, the Indexer model + must be provided instead of the name. It is enough to provide + the name of the indexer to delete unconditionally. + + :param name: The name of the indexer to delete. + :type name: str + :keyword match_condition: The match condition to use upon the etag + :type match_condition: ~azure.core.MatchConditions + + :return: None + :rtype: None + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_indexer_operations_async.py + :start-after: [START delete_indexer_async] + :end-before: [END delete_indexer_async] + :language: python + :dedent: 4 + :caption: Delete an Indexer + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + error_map, access_condition = get_access_conditions( + indexer, + kwargs.pop('match_condition', MatchConditions.Unconditionally) + ) + try: + name = indexer.name + except AttributeError: + name = indexer + await self._client.indexers.delete(name, access_condition=access_condition, error_map=error_map, **kwargs) + + @distributed_trace_async + async def run_indexer(self, name, **kwargs): + # type: (str, **Any) -> None + """Run an indexer. + + :param name: The name of the indexer to run. + :type name: str + + :return: None + :rtype: None + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_indexer_operations_async.py + :start-after: [START run_indexer_async] + :end-before: [END run_indexer_async] + :language: python + :dedent: 4 + :caption: Run an Indexer + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + await self._client.indexers.run(name, **kwargs) + + @distributed_trace_async + async def reset_indexer(self, name, **kwargs): + # type: (str, **Any) -> None + """Resets the change tracking state associated with an indexer. + + :param name: The name of the indexer to reset. + :type name: str + + :return: None + :rtype: None + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_indexer_operations_async.py + :start-after: [START reset_indexer_async] + :end-before: [END reset_indexer_async] + :language: python + :dedent: 4 + :caption: Reset an Indexer's change tracking state + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + await self._client.indexers.reset(name, **kwargs) + + @distributed_trace_async + async def get_indexer_status(self, name, **kwargs): + # type: (str, **Any) -> IndexerExecutionInfo + """Get the status of the indexer. + + :param name: The name of the indexer to fetch the status. + :type name: str + + :return: IndexerExecutionInfo + :rtype: IndexerExecutionInfo + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_indexer_operations_async.py + :start-after: [START get_indexer_status_async] + :end-before: [END get_indexer_status_async] + :language: python + :dedent: 4 + :caption: Get an Indexer's status + """ + kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + return await self._client.indexers.get_status(name, **kwargs) diff --git a/sdk/search/azure-search-documents/azure/search/documents/_service/aio/_search_service_client_async.py b/sdk/search/azure-search-documents/azure/search/documents/_service/aio/_search_service_client_async.py index a395d74423e6..6a5969b39443 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_service/aio/_search_service_client_async.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_service/aio/_search_service_client_async.py @@ -12,6 +12,7 @@ from ..._version import SDK_MONIKER from ._datasources_client import SearchDataSourcesClient from ._indexes_client import SearchIndexesClient +from ._indexers_client import SearchIndexersClient from ._skillsets_client import SearchSkillsetsClient from ._synonym_maps_client import SearchSynonymMapsClient @@ -62,6 +63,8 @@ def __init__(self, endpoint, credential, **kwargs): endpoint, credential, **kwargs ) + self._indexers_client = SearchIndexersClient(endpoint, credential, **kwargs) + def __repr__(self): # type: () -> str return "".format(repr(self._endpoint))[:1024] @@ -125,3 +128,12 @@ def get_datasources_client(self) -> SearchDataSourcesClient: :rtype: SearchDataSourcesClient """ return self._datasources_client + + def get_indexers_client(self): + # type: () -> SearchIndexersClient + """Return a client to perform operations on Data Sources. + + :return: The Data Sources client + :rtype: SearchDataSourcesClient + """ + return self._indexers_client diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_indexer.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_indexer.yaml new file mode 100644 index 000000000000..762f27bc0169 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_indexer.yaml @@ -0,0 +1,134 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 744FFCF0491F0B26839B316B16315B14 + method: POST + uri: https://search86f511ac.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search86f511ac.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED523B5C3F45\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:02:53 GMT + elapsed-time: '59' + etag: W/"0x8D7ED523B5C3F45" + expires: '-1' + location: https://search86f511ac.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 57367230-8b2e-11ea-b9d4-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86f511ac.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 744FFCF0491F0B26839B316B16315B14 + method: POST + uri: https://search86f511ac.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search86f511ac.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED523C16624C\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:02:54 GMT + elapsed-time: '1067' + etag: W/"0x8D7ED523C16624C" + expires: '-1' + location: https://search86f511ac.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 576467a8-8b2e-11ea-9b19-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86f511ac.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 744FFCF0491F0B26839B316B16315B14 + method: POST + uri: https://search86f511ac.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search86f511ac.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED523C6B487D\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:02:55 GMT + elapsed-time: '477' + etag: W/"0x8D7ED523C6B487D" + expires: '-1' + location: https://search86f511ac.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 5823b39c-8b2e-11ea-8172-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86f511ac.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_or_update_indexer.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_or_update_indexer.yaml new file mode 100644 index 000000000000..f7d434972654 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_or_update_indexer.yaml @@ -0,0 +1,299 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 33CE7005C1C6B7AD1940F1F955206F0C + method: POST + uri: https://search4e7415ce.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4e7415ce.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5245E6B25F\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:11 GMT + elapsed-time: '66' + etag: W/"0x8D7ED5245E6B25F" + expires: '-1' + location: https://search4e7415ce.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 61c200fe-8b2e-11ea-b14a-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search4e7415ce.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 33CE7005C1C6B7AD1940F1F955206F0C + method: POST + uri: https://search4e7415ce.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4e7415ce.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED5246809D54\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:12 GMT + elapsed-time: '937' + etag: W/"0x8D7ED5246809D54" + expires: '-1' + location: https://search4e7415ce.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 61ebb4be-8b2e-11ea-b304-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search4e7415ce.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 33CE7005C1C6B7AD1940F1F955206F0C + method: POST + uri: https://search4e7415ce.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4e7415ce.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5246E0D021\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:12 GMT + elapsed-time: '497' + etag: W/"0x8D7ED5246E0D021" + expires: '-1' + location: https://search4e7415ce.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 6293ddd0-8b2e-11ea-8958-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search4e7415ce.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 33CE7005C1C6B7AD1940F1F955206F0C + method: GET + uri: https://search4e7415ce.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4e7415ce.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED5246E0D021\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '367' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:12 GMT + elapsed-time: '10' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 62f77dda-8b2e-11ea-b48f-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search4e7415ce.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "description": "updated", "dataSourceName": + "sample-datasource", "targetIndexName": "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '139' + Content-Type: + - application/json + Prefer: + - return=representation + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 33CE7005C1C6B7AD1940F1F955206F0C + method: PUT + uri: https://search4e7415ce.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4e7415ce.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED524712E5C1\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '366' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:12 GMT + elapsed-time: '117' + etag: W/"0x8D7ED524712E5C1" + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 62ff1a62-8b2e-11ea-a0eb-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search4e7415ce.search.windows.net + - /indexers('sample-indexer') + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 33CE7005C1C6B7AD1940F1F955206F0C + method: GET + uri: https://search4e7415ce.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4e7415ce.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED524712E5C1\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:12 GMT + elapsed-time: '9' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 63180ee8-8b2e-11ea-89e7-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search4e7415ce.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 33CE7005C1C6B7AD1940F1F955206F0C + method: GET + uri: https://search4e7415ce.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4e7415ce.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED524712E5C1\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '366' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:12 GMT + elapsed-time: '8' + etag: W/"0x8D7ED524712E5C1" + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 631f84ac-8b2e-11ea-b6f2-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search4e7415ce.search.windows.net + - /indexers('sample-indexer') + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_or_update_indexer_if_unchanged.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_or_update_indexer_if_unchanged.yaml new file mode 100644 index 000000000000..ca3b9d3159f8 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_create_or_update_indexer_if_unchanged.yaml @@ -0,0 +1,231 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - CC67BBE5FAC0EC61208F4429C9C01592 + method: POST + uri: https://search8e821b08.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search8e821b08.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7EE17D9DD041D\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:30 GMT + elapsed-time: '32' + etag: W/"0x8D7EE17D9DD041D" + expires: '-1' + location: https://search8e821b08.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: f6432b12-8bf3-11ea-bd5a-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search8e821b08.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - CC67BBE5FAC0EC61208F4429C9C01592 + method: POST + uri: https://search8e821b08.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search8e821b08.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7EE17DA8617D8\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:31 GMT + elapsed-time: '968' + etag: W/"0x8D7EE17DA8617D8" + expires: '-1' + location: https://search8e821b08.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: f672a610-8bf3-11ea-8c8c-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search8e821b08.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - CC67BBE5FAC0EC61208F4429C9C01592 + method: POST + uri: https://search8e821b08.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search8e821b08.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7EE17DAB71EF3\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:31 GMT + elapsed-time: '170' + etag: W/"0x8D7EE17DAB71EF3" + expires: '-1' + location: https://search8e821b08.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: f71ffb94-8bf3-11ea-a6a4-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search8e821b08.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "description": "updated", "dataSourceName": + "sample-datasource", "targetIndexName": "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '139' + Content-Type: + - application/json + Prefer: + - return=representation + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - CC67BBE5FAC0EC61208F4429C9C01592 + method: PUT + uri: https://search8e821b08.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search8e821b08.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7EE17DAD7A74B\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '366' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:31 GMT + elapsed-time: '109' + etag: W/"0x8D7EE17DAD7A74B" + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: f7558040-8bf3-11ea-9716-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search8e821b08.search.windows.net + - /indexers('sample-indexer') + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "description": "updated", "dataSourceName": + "sample-datasource", "targetIndexName": "hotels", "disabled": false, "@odata.etag": + "\"0x8D7EE17DAB71EF3\""}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '179' + Content-Type: + - application/json + If-Match: + - '"0x8D7EE17DAB71EF3"' + Prefer: + - return=representation + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - CC67BBE5FAC0EC61208F4429C9C01592 + method: PUT + uri: https://search8e821b08.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"error":{"code":"","message":"The precondition given in one of the + request headers evaluated to false. No change was made to the resource from + this request."}}' + headers: + cache-control: no-cache + content-language: en + content-length: '160' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:31 GMT + elapsed-time: '8' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: f76d64b6-8bf3-11ea-a29c-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 412 + message: Precondition Failed + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search8e821b08.search.windows.net + - /indexers('sample-indexer') + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_delete_indexer.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_delete_indexer.yaml new file mode 100644 index 000000000000..711bacb35dd7 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_delete_indexer.yaml @@ -0,0 +1,245 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - A7E0BDA1BE1FB2465CBEE33F06D595D9 + method: POST + uri: https://search86da11ab.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search86da11ab.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5250DC08AE\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:28 GMT + elapsed-time: '25' + etag: W/"0x8D7ED5250DC08AE" + expires: '-1' + location: https://search86da11ab.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 6cc4b0ac-8b2e-11ea-8ee6-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86da11ab.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - A7E0BDA1BE1FB2465CBEE33F06D595D9 + method: POST + uri: https://search86da11ab.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search86da11ab.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED5251897F3E\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:30 GMT + elapsed-time: '1009' + etag: W/"0x8D7ED5251897F3E" + expires: '-1' + location: https://search86da11ab.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 6ce0d926-8b2e-11ea-b21a-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86da11ab.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - A7E0BDA1BE1FB2465CBEE33F06D595D9 + method: POST + uri: https://search86da11ab.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search86da11ab.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5251C6452B\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:31 GMT + elapsed-time: '191' + etag: W/"0x8D7ED5251C6452B" + expires: '-1' + location: https://search86da11ab.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 6d94440c-8b2e-11ea-811b-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86da11ab.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - A7E0BDA1BE1FB2465CBEE33F06D595D9 + method: GET + uri: https://search86da11ab.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search86da11ab.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED5251C6452B\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '367' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:31 GMT + elapsed-time: '12' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 6dd3e1dc-8b2e-11ea-bace-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86da11ab.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - A7E0BDA1BE1FB2465CBEE33F06D595D9 + method: DELETE + uri: https://search86da11ab.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '' + headers: + cache-control: no-cache + date: Thu, 30 Apr 2020 22:03:31 GMT + elapsed-time: '35' + expires: '-1' + pragma: no-cache + request-id: 6ddc19d0-8b2e-11ea-b6de-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 204 + message: No Content + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86da11ab.search.windows.net + - /indexers('sample-indexer') + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - A7E0BDA1BE1FB2465CBEE33F06D595D9 + method: GET + uri: https://search86da11ab.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search86da11ab.search.windows.net/$metadata#indexers","value":[]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '200' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:31 GMT + elapsed-time: '5' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 6de86d64-8b2e-11ea-9060-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search86da11ab.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_delete_indexer_if_unchanged.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_delete_indexer_if_unchanged.yaml new file mode 100644 index 000000000000..fbe9bda8f480 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_delete_indexer_if_unchanged.yaml @@ -0,0 +1,223 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 783079AE343B72D1129A6B85CDBDA067 + method: POST + uri: https://search912116e5.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search912116e5.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7EE17E46EB769\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:47 GMT + elapsed-time: '29' + etag: W/"0x8D7EE17E46EB769" + expires: '-1' + location: https://search912116e5.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 00db4fa6-8bf4-11ea-a835-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search912116e5.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 783079AE343B72D1129A6B85CDBDA067 + method: POST + uri: https://search912116e5.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search912116e5.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7EE17E50DDDD6\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:49 GMT + elapsed-time: '894' + etag: W/"0x8D7EE17E50DDDD6" + expires: '-1' + location: https://search912116e5.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 0104db46-8bf4-11ea-9602-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search912116e5.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 783079AE343B72D1129A6B85CDBDA067 + method: POST + uri: https://search912116e5.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search912116e5.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7EE17E53FF6AF\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:49 GMT + elapsed-time: '178' + etag: W/"0x8D7EE17E53FF6AF" + expires: '-1' + location: https://search912116e5.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 01a84c86-8bf4-11ea-a290-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search912116e5.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "description": "updated", "dataSourceName": + "sample-datasource", "targetIndexName": "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '139' + Content-Type: + - application/json + Prefer: + - return=representation + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 783079AE343B72D1129A6B85CDBDA067 + method: PUT + uri: https://search912116e5.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search912116e5.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7EE17E55EA9CF\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '367' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:49 GMT + elapsed-time: '102' + etag: W/"0x8D7EE17E55EA9CF" + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 01dd8fe8-8bf4-11ea-aa3a-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search912116e5.search.windows.net + - /indexers('sample-indexer') + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + If-Match: + - '"0x8D7EE17E53FF6AF"' + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 783079AE343B72D1129A6B85CDBDA067 + method: DELETE + uri: https://search912116e5.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"error":{"code":"","message":"The precondition given in one of the + request headers evaluated to false. No change was made to the resource from + this request."}}' + headers: + cache-control: no-cache + content-language: en + content-length: '160' + content-type: application/json; odata.metadata=minimal + date: Fri, 01 May 2020 21:37:49 GMT + elapsed-time: '4' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 01f415cc-8bf4-11ea-a820-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 412 + message: Precondition Failed + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search912116e5.search.windows.net + - /indexers('sample-indexer') + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_get_indexer.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_get_indexer.yaml new file mode 100644 index 000000000000..3de6bed0a700 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_get_indexer.yaml @@ -0,0 +1,174 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 593462469FF1D719FBE14D57F475C267 + method: POST + uri: https://search537a1078.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search537a1078.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED525B68C640\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:47 GMT + elapsed-time: '33' + etag: W/"0x8D7ED525B68C640" + expires: '-1' + location: https://search537a1078.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 774d90ca-8b2e-11ea-a1d3-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search537a1078.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 593462469FF1D719FBE14D57F475C267 + method: POST + uri: https://search537a1078.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search537a1078.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED525C1CCDAF\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:48 GMT + elapsed-time: '1058' + etag: W/"0x8D7ED525C1CCDAF" + expires: '-1' + location: https://search537a1078.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 776e4a3e-8b2e-11ea-ad83-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search537a1078.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 593462469FF1D719FBE14D57F475C267 + method: POST + uri: https://search537a1078.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search537a1078.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED525C4AC3DD\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:48 GMT + elapsed-time: '158' + etag: W/"0x8D7ED525C4AC3DD" + expires: '-1' + location: https://search537a1078.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 7827fb64-8b2e-11ea-8ebb-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search537a1078.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 593462469FF1D719FBE14D57F475C267 + method: GET + uri: https://search537a1078.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search537a1078.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED525C4AC3DD\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '363' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:03:48 GMT + elapsed-time: '4' + etag: W/"0x8D7ED525C4AC3DD" + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 7856b578-8b2e-11ea-ba8e-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search537a1078.search.windows.net + - /indexers('sample-indexer') + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_get_indexer_status.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_get_indexer_status.yaml new file mode 100644 index 000000000000..143a371a0ac1 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_get_indexer_status.yaml @@ -0,0 +1,173 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 8051098DD96B39E1AD1A3A668AAD41ED + method: POST + uri: https://searchd28e137b.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd28e137b.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5265E79E5F\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:04 GMT + elapsed-time: '80' + etag: W/"0x8D7ED5265E79E5F" + expires: '-1' + location: https://searchd28e137b.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 81c2547e-8b2e-11ea-afa8-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - searchd28e137b.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 8051098DD96B39E1AD1A3A668AAD41ED + method: POST + uri: https://searchd28e137b.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd28e137b.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED5266AB38FF\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:06 GMT + elapsed-time: '1144' + etag: W/"0x8D7ED5266AB38FF" + expires: '-1' + location: https://searchd28e137b.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 81f10de4-8b2e-11ea-adc2-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - searchd28e137b.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 8051098DD96B39E1AD1A3A668AAD41ED + method: POST + uri: https://searchd28e137b.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd28e137b.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5266E0F8C5\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:06 GMT + elapsed-time: '221' + etag: W/"0x8D7ED5266E0F8C5" + expires: '-1' + location: https://searchd28e137b.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 82b88f30-8b2e-11ea-bb2a-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - searchd28e137b.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 8051098DD96B39E1AD1A3A668AAD41ED + method: GET + uri: https://searchd28e137b.search.windows.net/indexers('sample-indexer')/search.status?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd28e137b.search.windows.net/$metadata#Microsoft.Azure.Search.V2019_05_06_Preview.IndexerExecutionInfo","name":"sample-indexer","status":"running","lastResult":null,"executionHistory":[],"limits":{"maxRunTime":"PT0S","maxDocumentExtractionSize":0,"maxDocumentContentCharactersToExtract":0}}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '365' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:06 GMT + elapsed-time: '17' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 82f39cec-8b2e-11ea-88bc-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - searchd28e137b.search.windows.net + - /indexers('sample-indexer')/search.status + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_list_indexer.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_list_indexer.yaml new file mode 100644 index 000000000000..75860b380900 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_list_indexer.yaml @@ -0,0 +1,305 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E2F9A0F43525EBB186C916380F592AD1 + method: POST + uri: https://search651610f4.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search651610f4.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED52C4646503\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:06:43 GMT + elapsed-time: '29' + etag: W/"0x8D7ED52C4646503" + expires: '-1' + location: https://search651610f4.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: e04c8094-8b2e-11ea-bc46-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search651610f4.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E2F9A0F43525EBB186C916380F592AD1 + method: POST + uri: https://search651610f4.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search651610f4.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED52C4C9C8F3\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:06:43 GMT + elapsed-time: '501' + etag: W/"0x8D7ED52C4C9C8F3" + expires: '-1' + location: https://search651610f4.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: e069b818-8b2e-11ea-8821-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search651610f4.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: 'b''{"name": "another-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '322' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E2F9A0F43525EBB186C916380F592AD1 + method: POST + uri: https://search651610f4.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search651610f4.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED52C4FA097A\"","name":"another-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '371' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:06:44 GMT + elapsed-time: '32' + etag: W/"0x8D7ED52C4FA097A" + expires: '-1' + location: https://search651610f4.search.windows.net/datasources('another-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: e0d3c8cc-8b2e-11ea-b18a-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search651610f4.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "another-index", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '114' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E2F9A0F43525EBB186C916380F592AD1 + method: POST + uri: https://search651610f4.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search651610f4.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED52C57E1E8D\"","name":"another-index","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '565' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:06:45 GMT + elapsed-time: '730' + etag: W/"0x8D7ED52C57E1E8D" + expires: '-1' + location: https://search651610f4.search.windows.net/indexes('another-index')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: e0ff4b7a-8b2e-11ea-aaf0-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search651610f4.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E2F9A0F43525EBB186C916380F592AD1 + method: POST + uri: https://search651610f4.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search651610f4.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED52C5DC2E27\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:06:45 GMT + elapsed-time: '540' + etag: W/"0x8D7ED52C5DC2E27" + expires: '-1' + location: https://search651610f4.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: e187cd64-8b2e-11ea-814c-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search651610f4.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "another-indexer", "dataSourceName": "another-datasource", "targetIndexName": + "another-index", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '122' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E2F9A0F43525EBB186C916380F592AD1 + method: POST + uri: https://search651610f4.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search651610f4.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED52C60A4B66\"","name":"another-indexer","description":null,"dataSourceName":"another-datasource","skillsetName":null,"targetIndexName":"another-index","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '371' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:06:46 GMT + elapsed-time: '191' + etag: W/"0x8D7ED52C60A4B66" + expires: '-1' + location: https://search651610f4.search.windows.net/indexers('another-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: e1f77fd2-8b2e-11ea-a8c8-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search651610f4.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E2F9A0F43525EBB186C916380F592AD1 + method: GET + uri: https://search651610f4.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search651610f4.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED52C60A4B66\"","name":"another-indexer","description":null,"dataSourceName":"another-datasource","skillsetName":null,"targetIndexName":"another-index","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null},{"@odata.etag":"\"0x8D7ED52C5DC2E27\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '405' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:06:46 GMT + elapsed-time: '13' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: e21bb800-8b2e-11ea-af1d-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search651610f4.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_reset_indexer.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_reset_indexer.yaml new file mode 100644 index 000000000000..697f4653f8a4 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_reset_indexer.yaml @@ -0,0 +1,245 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - B14D2D6E7CAFAD9A092431020450EC29 + method: POST + uri: https://search7658115b.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search7658115b.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED527A604F84\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:39 GMT + elapsed-time: '28' + etag: W/"0x8D7ED527A604F84" + expires: '-1' + location: https://search7658115b.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 963d594a-8b2e-11ea-82c8-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search7658115b.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - B14D2D6E7CAFAD9A092431020450EC29 + method: POST + uri: https://search7658115b.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search7658115b.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED527AF1D480\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:40 GMT + elapsed-time: '825' + etag: W/"0x8D7ED527AF1D480" + expires: '-1' + location: https://search7658115b.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 966561ba-8b2e-11ea-b432-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search7658115b.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - B14D2D6E7CAFAD9A092431020450EC29 + method: POST + uri: https://search7658115b.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search7658115b.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED527B299070\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:40 GMT + elapsed-time: '215' + etag: W/"0x8D7ED527B299070" + expires: '-1' + location: https://search7658115b.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 96fafb58-8b2e-11ea-be95-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search7658115b.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - B14D2D6E7CAFAD9A092431020450EC29 + method: GET + uri: https://search7658115b.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search7658115b.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED527B299070\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '368' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:40 GMT + elapsed-time: '9' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 9736c8a4-8b2e-11ea-b580-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search7658115b.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - B14D2D6E7CAFAD9A092431020450EC29 + method: POST + uri: https://search7658115b.search.windows.net/indexers('sample-indexer')/search.reset?api-version=2019-05-06-Preview + response: + body: + string: '' + headers: + cache-control: no-cache + date: Thu, 30 Apr 2020 22:04:40 GMT + elapsed-time: '138' + expires: '-1' + pragma: no-cache + request-id: 973eb276-8b2e-11ea-9c69-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 204 + message: No Content + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search7658115b.search.windows.net + - /indexers('sample-indexer')/search.reset + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - B14D2D6E7CAFAD9A092431020450EC29 + method: GET + uri: https://search7658115b.search.windows.net/indexers('sample-indexer')/search.status?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search7658115b.search.windows.net/$metadata#Microsoft.Azure.Search.V2019_05_06_Preview.IndexerExecutionInfo","name":"sample-indexer","status":"running","lastResult":{"status":"reset","errorMessage":null,"startTime":"2020-04-30T22:04:40.722Z","endTime":"2020-04-30T22:04:40.722Z","itemsProcessed":0,"itemsFailed":0,"initialTrackingState":null,"finalTrackingState":null,"errors":[],"warnings":[],"metrics":null},"executionHistory":[{"status":"reset","errorMessage":null,"startTime":"2020-04-30T22:04:40.722Z","endTime":"2020-04-30T22:04:40.722Z","itemsProcessed":0,"itemsFailed":0,"initialTrackingState":null,"finalTrackingState":null,"errors":[],"warnings":[],"metrics":null}],"limits":null}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '428' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:40 GMT + elapsed-time: '37' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: 97597b24-8b2e-11ea-8ecf-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search7658115b.search.windows.net + - /indexers('sample-indexer')/search.status + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_run_indexer.yaml b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_run_indexer.yaml new file mode 100644 index 000000000000..651d2c9988c6 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/async_tests/recordings/test_service_live_async.test_run_indexer.yaml @@ -0,0 +1,246 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7249924270B36D2B8D2CB30BD19258AA + method: POST + uri: https://search545d108d.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search545d108d.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5284CBEA3F\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: no-cache + content-length: '370' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:56 GMT + elapsed-time: '34' + etag: W/"0x8D7ED5284CBEA3F" + expires: '-1' + location: https://search545d108d.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: a0b44d68-8b2e-11ea-8600-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search545d108d.search.windows.net + - /datasources + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7249924270B36D2B8D2CB30BD19258AA + method: POST + uri: https://search545d108d.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search545d108d.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED5285782812\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: no-cache + content-length: '558' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:57 GMT + elapsed-time: '893' + etag: W/"0x8D7ED5285782812" + expires: '-1' + location: https://search545d108d.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: a0d1fa50-8b2e-11ea-b768-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search545d108d.search.windows.net + - /indexes + - api-version=2019-05-06-Preview + - '' +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7249924270B36D2B8D2CB30BD19258AA + method: POST + uri: https://search545d108d.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search545d108d.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5285A6937E\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: no-cache + content-length: '362' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:58 GMT + elapsed-time: '168' + etag: W/"0x8D7ED5285A6937E" + expires: '-1' + location: https://search545d108d.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: a181bf40-8b2e-11ea-a6b1-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search545d108d.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7249924270B36D2B8D2CB30BD19258AA + method: GET + uri: https://search545d108d.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search545d108d.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED5285A6937E\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '368' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:58 GMT + elapsed-time: '8' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: a1b2c330-8b2e-11ea-a4d0-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search545d108d.search.windows.net + - /indexers + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7249924270B36D2B8D2CB30BD19258AA + method: POST + uri: https://search545d108d.search.windows.net/indexers('sample-indexer')/search.run?api-version=2019-05-06-Preview + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Thu, 30 Apr 2020 22:04:58 GMT + elapsed-time: '30' + expires: '-1' + pragma: no-cache + request-id: a1bb955e-8b2e-11ea-832b-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + status: + code: 202 + message: Accepted + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search545d108d.search.windows.net + - /indexers('sample-indexer')/search.run + - api-version=2019-05-06-Preview + - '' +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7249924270B36D2B8D2CB30BD19258AA + method: GET + uri: https://search545d108d.search.windows.net/indexers('sample-indexer')/search.status?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search545d108d.search.windows.net/$metadata#Microsoft.Azure.Search.V2019_05_06_Preview.IndexerExecutionInfo","name":"sample-indexer","status":"running","lastResult":null,"executionHistory":[],"limits":{"maxRunTime":"PT0S","maxDocumentExtractionSize":0,"maxDocumentContentCharactersToExtract":0}}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '365' + content-type: application/json; odata.metadata=minimal + date: Thu, 30 Apr 2020 22:04:58 GMT + elapsed-time: '12' + expires: '-1' + odata-version: '4.0' + pragma: no-cache + preference-applied: odata.include-annotations="*" + request-id: a1c616b4-8b2e-11ea-8513-2816a845e8c6 + strict-transport-security: max-age=15724800; includeSubDomains + vary: Accept-Encoding + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - search545d108d.search.windows.net + - /indexers('sample-indexer')/search.status + - api-version=2019-05-06-Preview + - '' +version: 1 diff --git a/sdk/search/azure-search-documents/tests/async_tests/test_service_live_async.py b/sdk/search/azure-search-documents/tests/async_tests/test_service_live_async.py index 48b5c3e46fb0..d9c8d18700f4 100644 --- a/sdk/search/azure-search-documents/tests/async_tests/test_service_live_async.py +++ b/sdk/search/azure-search-documents/tests/async_tests/test_service_live_async.py @@ -34,6 +34,7 @@ DataSourceCredentials, DataSource, DataContainer, + Indexer, SynonymMap, SimpleField, edm @@ -603,3 +604,149 @@ async def test_delete_datasource_if_unchanged(self, api_key, endpoint, index_nam with pytest.raises(HttpResponseError): await client.delete_datasource(data_source, match_condition=MatchConditions.IfNotModified) assert len(await client.get_datasources()) == 1 + +class SearchIndexersClientTest(AzureMgmtTestCase): + + async def _prepare_indexer(self, endpoint, api_key, name="sample-indexer", ds_name="sample-datasource", id_name="hotels"): + con_str = self.settings.AZURE_STORAGE_CONNECTION_STRING + self.scrubber.register_name_pair(con_str, 'connection_string') + credentials = DataSourceCredentials(connection_string=con_str) + container = DataContainer(name='searchcontainer') + data_source = DataSource( + name=ds_name, + type="azureblob", + credentials=credentials, + container=container + ) + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)) + ds_client = client.get_datasources_client() + ds = await ds_client.create_datasource(data_source) + + index_name = id_name + fields = [ + { + "name": "hotelId", + "type": "Edm.String", + "key": True, + "searchable": False + }] + index = Index(name=index_name, fields=fields) + ind_client = client.get_indexes_client() + ind = await ind_client.create_index(index) + return Indexer(name=name, data_source_name=ds.name, target_index_name=ind.name) + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_create_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + result = await client.create_indexer(indexer) + assert result.name == "sample-indexer" + assert result.target_index_name == "hotels" + assert result.data_source_name == "sample-datasource" + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_delete_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + result = await client.create_indexer(indexer) + assert len(await client.get_indexers()) == 1 + await client.delete_indexer("sample-indexer") + assert len(await client.get_indexers()) == 0 + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_get_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + created = await client.create_indexer(indexer) + result = await client.get_indexer("sample-indexer") + assert result.name == "sample-indexer" + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_list_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer1 = await self._prepare_indexer(endpoint, api_key) + indexer2 = await self._prepare_indexer(endpoint, api_key, name="another-indexer", ds_name="another-datasource", id_name="another-index") + created1 = await client.create_indexer(indexer1) + created2 = await client.create_indexer(indexer2) + result = await client.get_indexers() + assert isinstance(result, list) + assert set(x.name for x in result) == {"sample-indexer", "another-indexer"} + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_create_or_update_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + created = await client.create_indexer(indexer) + assert len(await client.get_indexers()) == 1 + indexer.description = "updated" + await client.create_or_update_indexer(indexer) + assert len(await client.get_indexers()) == 1 + result = await client.get_indexer("sample-indexer") + assert result.name == "sample-indexer" + assert result.description == "updated" + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_reset_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + result = await client.create_indexer(indexer) + assert len(await client.get_indexers()) == 1 + await client.reset_indexer("sample-indexer") + assert (await client.get_indexer_status("sample-indexer")).last_result.status in ('InProgress', 'reset') + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_run_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + result = await client.create_indexer(indexer) + assert len(await client.get_indexers()) == 1 + start = time.time() + await client.run_indexer("sample-indexer") + assert (await client.get_indexer_status("sample-indexer")).status == 'running' + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_get_indexer_status(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + result = await client.create_indexer(indexer) + status = await client.get_indexer_status("sample-indexer") + assert status.status is not None + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_create_or_update_indexer_if_unchanged(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + created = await client.create_indexer(indexer) + etag = created.e_tag + + + indexer.description = "updated" + await client.create_or_update_indexer(indexer) + + indexer.e_tag = etag + with pytest.raises(HttpResponseError): + await client.create_or_update_indexer(indexer, match_condition=MatchConditions.IfNotModified) + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + async def test_delete_indexer_if_unchanged(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = await self._prepare_indexer(endpoint, api_key) + result = await client.create_indexer(indexer) + etag = result.e_tag + + indexer.description = "updated" + await client.create_or_update_indexer(indexer) + + indexer.e_tag = etag + with pytest.raises(HttpResponseError): + await client.delete_indexer(indexer, match_condition=MatchConditions.IfNotModified) diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_indexer.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_indexer.yaml new file mode 100644 index 000000000000..d9d9ead51262 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_indexer.yaml @@ -0,0 +1,161 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 77C02FA230F2A765BD5521B74DD1F4A6 + method: POST + uri: https://search21dc0f2f.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search21dc0f2f.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED510D525790\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:26 GMT + elapsed-time: + - '44' + etag: + - W/"0x8D7ED510D525790" + expires: + - '-1' + location: + - https://search21dc0f2f.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 29133c98-8b2d-11ea-abb9-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 77C02FA230F2A765BD5521B74DD1F4A6 + method: POST + uri: https://search21dc0f2f.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search21dc0f2f.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED510E3391AF\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:27 GMT + elapsed-time: + - '969' + etag: + - W/"0x8D7ED510E3391AF" + expires: + - '-1' + location: + - https://search21dc0f2f.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 2957de74-8b2d-11ea-89cc-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 77C02FA230F2A765BD5521B74DD1F4A6 + method: POST + uri: https://search21dc0f2f.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search21dc0f2f.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED510EA2BB62\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:28 GMT + elapsed-time: + - '487' + etag: + - W/"0x8D7ED510EA2BB62" + expires: + - '-1' + location: + - https://search21dc0f2f.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 2a3d34b8-8b2d-11ea-9811-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_or_update_indexer.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_or_update_indexer.yaml new file mode 100644 index 000000000000..0574fdf5ebdf --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_or_update_indexer.yaml @@ -0,0 +1,356 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 611B37AA724F1C68730D7CF6A8C3A842 + method: POST + uri: https://searchd06a1351.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd06a1351.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5117F9A6D3\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:43 GMT + elapsed-time: + - '59' + etag: + - W/"0x8D7ED5117F9A6D3" + expires: + - '-1' + location: + - https://searchd06a1351.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 33c2ac1c-8b2d-11ea-ae25-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 611B37AA724F1C68730D7CF6A8C3A842 + method: POST + uri: https://searchd06a1351.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd06a1351.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED511891E3D4\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:45 GMT + elapsed-time: + - '570' + etag: + - W/"0x8D7ED511891E3D4" + expires: + - '-1' + location: + - https://searchd06a1351.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 33ff425e-8b2d-11ea-a101-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 611B37AA724F1C68730D7CF6A8C3A842 + method: POST + uri: https://searchd06a1351.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd06a1351.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5118EC7055\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:45 GMT + elapsed-time: + - '174' + etag: + - W/"0x8D7ED5118EC7055" + expires: + - '-1' + location: + - https://searchd06a1351.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 34a04426-8b2d-11ea-9aca-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 611B37AA724F1C68730D7CF6A8C3A842 + method: GET + uri: https://searchd06a1351.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd06a1351.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED5118EC7055\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: + - no-cache + content-length: + - '366' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:45 GMT + elapsed-time: + - '26' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 34fad200-8b2d-11ea-be97-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +- request: + body: '{"name": "sample-indexer", "description": "updated", "dataSourceName": + "sample-datasource", "targetIndexName": "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '139' + Content-Type: + - application/json + Prefer: + - return=representation + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 611B37AA724F1C68730D7CF6A8C3A842 + method: PUT + uri: https://searchd06a1351.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd06a1351.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED511931C355\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '367' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:46 GMT + elapsed-time: + - '109' + etag: + - W/"0x8D7ED511931C355" + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 3512418a-8b2d-11ea-bd46-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 611B37AA724F1C68730D7CF6A8C3A842 + method: GET + uri: https://searchd06a1351.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd06a1351.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED511931C355\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: + - no-cache + content-length: + - '371' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:46 GMT + elapsed-time: + - '9' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 3536ee86-8b2d-11ea-ad34-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 611B37AA724F1C68730D7CF6A8C3A842 + method: GET + uri: https://searchd06a1351.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchd06a1351.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED511931C355\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '367' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:54:46 GMT + elapsed-time: + - '4' + etag: + - W/"0x8D7ED511931C355" + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 354b52a2-8b2d-11ea-b04c-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_or_update_indexer_if_unchanged.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_or_update_indexer_if_unchanged.yaml new file mode 100644 index 000000000000..2ef20dfd9b3a --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_create_or_update_indexer_if_unchanged.yaml @@ -0,0 +1,274 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7966DDD092384BAD2A12CDC8418DF7D1 + method: POST + uri: https://searchf01f188b.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf01f188b.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7EE17B51C89C5\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:28 GMT + elapsed-time: + - '51' + etag: + - W/"0x8D7EE17B51C89C5" + expires: + - '-1' + location: + - https://searchf01f188b.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - d169ba42-8bf3-11ea-923a-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7966DDD092384BAD2A12CDC8418DF7D1 + method: POST + uri: https://searchf01f188b.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf01f188b.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7EE17B5D72DF6\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:29 GMT + elapsed-time: + - '904' + etag: + - W/"0x8D7EE17B5D72DF6" + expires: + - '-1' + location: + - https://searchf01f188b.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - d1b36228-8bf3-11ea-bd02-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7966DDD092384BAD2A12CDC8418DF7D1 + method: POST + uri: https://searchf01f188b.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf01f188b.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7EE17B61DBE45\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:30 GMT + elapsed-time: + - '173' + etag: + - W/"0x8D7EE17B61DBE45" + expires: + - '-1' + location: + - https://searchf01f188b.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - d2708c82-8bf3-11ea-b7e1-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "description": "updated", "dataSourceName": + "sample-datasource", "targetIndexName": "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '139' + Content-Type: + - application/json + Prefer: + - return=representation + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7966DDD092384BAD2A12CDC8418DF7D1 + method: PUT + uri: https://searchf01f188b.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf01f188b.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7EE17B646D43E\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '367' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:30 GMT + elapsed-time: + - '129' + etag: + - W/"0x8D7EE17B646D43E" + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - d2be281e-8bf3-11ea-9719-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +- request: + body: '{"name": "sample-indexer", "description": "updated", "dataSourceName": + "sample-datasource", "targetIndexName": "hotels", "disabled": false, "@odata.etag": + "\"0x8D7EE17B61DBE45\""}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '179' + Content-Type: + - application/json + If-Match: + - '"0x8D7EE17B61DBE45"' + Prefer: + - return=representation + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7966DDD092384BAD2A12CDC8418DF7D1 + method: PUT + uri: https://searchf01f188b.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"error":{"code":"","message":"The precondition given in one of the + request headers evaluated to false. No change was made to the resource from + this request."}}' + headers: + cache-control: + - no-cache + content-language: + - en + content-length: + - '160' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:30 GMT + elapsed-time: + - '8' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - d2de6b46-8bf3-11ea-a113-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 412 + message: Precondition Failed +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_delete_indexer.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_delete_indexer.yaml new file mode 100644 index 000000000000..3405a6a134d2 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_delete_indexer.yaml @@ -0,0 +1,291 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 9E6C3CF9019ACCA2B66CCE69981C8123 + method: POST + uri: https://search21c10f2e.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search21c10f2e.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5125E3C05D\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:07 GMT + elapsed-time: + - '30' + etag: + - W/"0x8D7ED5125E3C05D" + expires: + - '-1' + location: + - https://search21c10f2e.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 41a4e0ac-8b2d-11ea-80e0-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 9E6C3CF9019ACCA2B66CCE69981C8123 + method: POST + uri: https://search21c10f2e.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search21c10f2e.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED5126BDF45D\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:09 GMT + elapsed-time: + - '1090' + etag: + - W/"0x8D7ED5126BDF45D" + expires: + - '-1' + location: + - https://search21c10f2e.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 41e982d2-8b2d-11ea-aac9-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 9E6C3CF9019ACCA2B66CCE69981C8123 + method: POST + uri: https://search21c10f2e.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search21c10f2e.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5127191D3F\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:10 GMT + elapsed-time: + - '201' + etag: + - W/"0x8D7ED5127191D3F" + expires: + - '-1' + location: + - https://search21c10f2e.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 42cbcdde-8b2d-11ea-ac7d-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 9E6C3CF9019ACCA2B66CCE69981C8123 + method: GET + uri: https://search21c10f2e.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search21c10f2e.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED5127191D3F\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: + - no-cache + content-length: + - '366' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:10 GMT + elapsed-time: + - '8' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 43260b80-8b2d-11ea-b5d2-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 9E6C3CF9019ACCA2B66CCE69981C8123 + method: DELETE + uri: https://search21c10f2e.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Thu, 30 Apr 2020 21:55:10 GMT + elapsed-time: + - '99' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 4337b16e-8b2d-11ea-a646-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 9E6C3CF9019ACCA2B66CCE69981C8123 + method: GET + uri: https://search21c10f2e.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search21c10f2e.search.windows.net/$metadata#indexers","value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '92' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:10 GMT + elapsed-time: + - '4' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 435622e2-8b2d-11ea-97eb-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_delete_indexer_if_unchanged.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_delete_indexer_if_unchanged.yaml new file mode 100644 index 000000000000..2e561597eb11 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_delete_indexer_if_unchanged.yaml @@ -0,0 +1,268 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E3F54485B0A3180E091774FCC0413692 + method: POST + uri: https://searchbaf1468.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchbaf1468.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7EE17BEFA29F2\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '369' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:45 GMT + elapsed-time: + - '45' + etag: + - W/"0x8D7EE17BEFA29F2" + expires: + - '-1' + location: + - https://searchbaf1468.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - db51671a-8bf3-11ea-a801-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E3F54485B0A3180E091774FCC0413692 + method: POST + uri: https://searchbaf1468.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchbaf1468.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7EE17BF71C167\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '557' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:46 GMT + elapsed-time: + - '492' + etag: + - W/"0x8D7EE17BF71C167" + expires: + - '-1' + location: + - https://searchbaf1468.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - db9019e8-8bf3-11ea-8645-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E3F54485B0A3180E091774FCC0413692 + method: POST + uri: https://searchbaf1468.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchbaf1468.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7EE17BFE1B5D9\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '361' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:46 GMT + elapsed-time: + - '498' + etag: + - W/"0x8D7EE17BFE1B5D9" + expires: + - '-1' + location: + - https://searchbaf1468.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - dc0b5cde-8bf3-11ea-930e-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "description": "updated", "dataSourceName": + "sample-datasource", "targetIndexName": "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '139' + Content-Type: + - application/json + Prefer: + - return=representation + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E3F54485B0A3180E091774FCC0413692 + method: PUT + uri: https://searchbaf1468.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchbaf1468.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7EE17C015077F\"","name":"sample-indexer","description":"updated","dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '366' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:46 GMT + elapsed-time: + - '124' + etag: + - W/"0x8D7EE17C015077F" + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - dc8c1cec-8bf3-11ea-844d-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + If-Match: + - '"0x8D7EE17BFE1B5D9"' + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - E3F54485B0A3180E091774FCC0413692 + method: DELETE + uri: https://searchbaf1468.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"error":{"code":"","message":"The precondition given in one of the + request headers evaluated to false. No change was made to the resource from + this request."}}' + headers: + cache-control: + - no-cache + content-language: + - en + content-length: + - '160' + content-type: + - application/json; odata.metadata=minimal + date: + - Fri, 01 May 2020 21:36:46 GMT + elapsed-time: + - '7' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - dcac37e4-8bf3-11ea-a911-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 412 + message: Precondition Failed +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_get_indexer.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_get_indexer.yaml new file mode 100644 index 000000000000..93dd175e56f3 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_get_indexer.yaml @@ -0,0 +1,209 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - EF6DF05F92A8948F94DCE2B89C2D1E9C + method: POST + uri: https://searchf5c90dfb.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf5c90dfb.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5130775CFC\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:25 GMT + elapsed-time: + - '56' + etag: + - W/"0x8D7ED5130775CFC" + expires: + - '-1' + location: + - https://searchf5c90dfb.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 4c3ea7da-8b2d-11ea-8524-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - EF6DF05F92A8948F94DCE2B89C2D1E9C + method: POST + uri: https://searchf5c90dfb.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf5c90dfb.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED51313C576E\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:27 GMT + elapsed-time: + - '879' + etag: + - W/"0x8D7ED51313C576E" + expires: + - '-1' + location: + - https://searchf5c90dfb.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 4c7cbf1e-8b2d-11ea-a414-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - EF6DF05F92A8948F94DCE2B89C2D1E9C + method: POST + uri: https://searchf5c90dfb.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf5c90dfb.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5131BBB0C0\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:28 GMT + elapsed-time: + - '544' + etag: + - W/"0x8D7ED5131BBB0C0" + expires: + - '-1' + location: + - https://searchf5c90dfb.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 4d4946ee-8b2d-11ea-9df9-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - EF6DF05F92A8948F94DCE2B89C2D1E9C + method: GET + uri: https://searchf5c90dfb.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf5c90dfb.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5131BBB0C0\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:28 GMT + elapsed-time: + - '9' + etag: + - W/"0x8D7ED5131BBB0C0" + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 4dd6800c-8b2d-11ea-ba87-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_get_indexer_status.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_get_indexer_status.yaml new file mode 100644 index 000000000000..369012392a66 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_get_indexer_status.yaml @@ -0,0 +1,207 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 58F301B68D82458CCAFF56AF190D90E9 + method: POST + uri: https://search638110fe.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search638110fe.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED513BD34FD0\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:44 GMT + elapsed-time: + - '48' + etag: + - W/"0x8D7ED513BD34FD0" + expires: + - '-1' + location: + - https://search638110fe.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 5796c2d2-8b2d-11ea-a954-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 58F301B68D82458CCAFF56AF190D90E9 + method: POST + uri: https://search638110fe.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search638110fe.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED513C63EA4A\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:45 GMT + elapsed-time: + - '469' + etag: + - W/"0x8D7ED513C63EA4A" + expires: + - '-1' + location: + - https://search638110fe.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 57d945a6-8b2d-11ea-a995-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 58F301B68D82458CCAFF56AF190D90E9 + method: POST + uri: https://search638110fe.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search638110fe.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED513CD9A4E5\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:45 GMT + elapsed-time: + - '484' + etag: + - W/"0x8D7ED513CD9A4E5" + expires: + - '-1' + location: + - https://search638110fe.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 586c971a-8b2d-11ea-bcad-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 58F301B68D82458CCAFF56AF190D90E9 + method: GET + uri: https://search638110fe.search.windows.net/indexers('sample-indexer')/search.status?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search638110fe.search.windows.net/$metadata#Microsoft.Azure.Search.V2019_05_06_Preview.IndexerExecutionInfo","name":"sample-indexer","status":"running","lastResult":null,"executionHistory":[],"limits":{"maxRunTime":"PT0S","maxDocumentExtractionSize":0,"maxDocumentContentCharactersToExtract":0}}' + headers: + cache-control: + - no-cache + content-length: + - '322' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:55:45 GMT + elapsed-time: + - '13' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 58f2f5a4-8b2d-11ea-9e2c-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_list_indexer.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_list_indexer.yaml new file mode 100644 index 000000000000..e77207c1cc77 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_list_indexer.yaml @@ -0,0 +1,366 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - FAD6BE165A2964FC68B2409CBD3188D3 + method: POST + uri: https://search4f70e77.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4f70e77.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5146AB7BFE\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '369' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:03 GMT + elapsed-time: + - '78' + etag: + - W/"0x8D7ED5146AB7BFE" + expires: + - '-1' + location: + - https://search4f70e77.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 6268263a-8b2d-11ea-8b3a-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - FAD6BE165A2964FC68B2409CBD3188D3 + method: POST + uri: https://search4f70e77.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4f70e77.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED5147408421\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '557' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:03 GMT + elapsed-time: + - '501' + etag: + - W/"0x8D7ED5147408421" + expires: + - '-1' + location: + - https://search4f70e77.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 62b10964-8b2d-11ea-aa1f-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: 'b''{"name": "another-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '322' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - FAD6BE165A2964FC68B2409CBD3188D3 + method: POST + uri: https://search4f70e77.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4f70e77.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED514792D1C2\"","name":"another-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:03 GMT + elapsed-time: + - '29' + etag: + - W/"0x8D7ED514792D1C2" + expires: + - '-1' + location: + - https://search4f70e77.search.windows.net/datasources('another-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 634ba6ee-8b2d-11ea-b3b9-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "another-index", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '114' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - FAD6BE165A2964FC68B2409CBD3188D3 + method: POST + uri: https://search4f70e77.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4f70e77.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED51484C7F82\"","name":"another-index","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '564' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:05 GMT + elapsed-time: + - '869' + etag: + - W/"0x8D7ED51484C7F82" + expires: + - '-1' + location: + - https://search4f70e77.search.windows.net/indexes('another-index')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 63979858-8b2d-11ea-baf6-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - FAD6BE165A2964FC68B2409CBD3188D3 + method: POST + uri: https://search4f70e77.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4f70e77.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED51489A5F94\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '361' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:06 GMT + elapsed-time: + - '168' + etag: + - W/"0x8D7ED51489A5F94" + expires: + - '-1' + location: + - https://search4f70e77.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 645647e8-8b2d-11ea-a877-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "another-indexer", "dataSourceName": "another-datasource", "targetIndexName": + "another-index", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '122' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - FAD6BE165A2964FC68B2409CBD3188D3 + method: POST + uri: https://search4f70e77.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4f70e77.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5148C94048\"","name":"another-indexer","description":null,"dataSourceName":"another-datasource","skillsetName":null,"targetIndexName":"another-index","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:06 GMT + elapsed-time: + - '191' + etag: + - W/"0x8D7ED5148C94048" + expires: + - '-1' + location: + - https://search4f70e77.search.windows.net/indexers('another-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 64a826a2-8b2d-11ea-bfa5-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - FAD6BE165A2964FC68B2409CBD3188D3 + method: GET + uri: https://search4f70e77.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search4f70e77.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED5148C94048\"","name":"another-indexer","description":null,"dataSourceName":"another-datasource","skillsetName":null,"targetIndexName":"another-index","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null},{"@odata.etag":"\"0x8D7ED51489A5F94\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: + - no-cache + content-length: + - '649' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:06 GMT + elapsed-time: + - '33' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 64d7a0c2-8b2d-11ea-95d8-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_reset_indexer.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_reset_indexer.yaml new file mode 100644 index 000000000000..e24449563398 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_reset_indexer.yaml @@ -0,0 +1,291 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7F271F32C4D5BFC55396C3FF580E49E7 + method: POST + uri: https://search13bc0ede.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search13bc0ede.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED51B1466EFF\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:59:01 GMT + elapsed-time: + - '52' + etag: + - W/"0x8D7ED51B1466EFF" + expires: + - '-1' + location: + - https://search13bc0ede.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - cd1d664c-8b2d-11ea-96b0-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7F271F32C4D5BFC55396C3FF580E49E7 + method: POST + uri: https://search13bc0ede.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search13bc0ede.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED51B2085B9F\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:59:03 GMT + elapsed-time: + - '940' + etag: + - W/"0x8D7ED51B2085B9F" + expires: + - '-1' + location: + - https://search13bc0ede.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - cd4b0f40-8b2d-11ea-b316-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7F271F32C4D5BFC55396C3FF580E49E7 + method: POST + uri: https://search13bc0ede.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search13bc0ede.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED51B275D75A\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:59:03 GMT + elapsed-time: + - '524' + etag: + - W/"0x8D7ED51B275D75A" + expires: + - '-1' + location: + - https://search13bc0ede.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - ce107046-8b2d-11ea-8aa0-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7F271F32C4D5BFC55396C3FF580E49E7 + method: GET + uri: https://search13bc0ede.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search13bc0ede.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED51B275D75A\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: + - no-cache + content-length: + - '366' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:59:03 GMT + elapsed-time: + - '19' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - ce880c1e-8b2d-11ea-89cc-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7F271F32C4D5BFC55396C3FF580E49E7 + method: POST + uri: https://search13bc0ede.search.windows.net/indexers('sample-indexer')/search.reset?api-version=2019-05-06-Preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Thu, 30 Apr 2020 21:59:03 GMT + elapsed-time: + - '137' + expires: + - '-1' + pragma: + - no-cache + request-id: + - ce976af4-8b2d-11ea-827e-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 7F271F32C4D5BFC55396C3FF580E49E7 + method: GET + uri: https://search13bc0ede.search.windows.net/indexers('sample-indexer')/search.status?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://search13bc0ede.search.windows.net/$metadata#Microsoft.Azure.Search.V2019_05_06_Preview.IndexerExecutionInfo","name":"sample-indexer","status":"running","lastResult":{"status":"reset","errorMessage":null,"startTime":"2020-04-30T21:59:04.132Z","endTime":"2020-04-30T21:59:04.132Z","itemsProcessed":0,"itemsFailed":0,"initialTrackingState":null,"finalTrackingState":null,"errors":[],"warnings":[],"metrics":null},"executionHistory":[{"status":"reset","errorMessage":null,"startTime":"2020-04-30T21:59:04.132Z","endTime":"2020-04-30T21:59:04.132Z","itemsProcessed":0,"itemsFailed":0,"initialTrackingState":null,"finalTrackingState":null,"errors":[],"warnings":[],"metrics":null}],"limits":null}' + headers: + cache-control: + - no-cache + content-length: + - '717' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:59:03 GMT + elapsed-time: + - '10' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - ceb981ae-8b2d-11ea-989d-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_run_indexer.yaml b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_run_indexer.yaml new file mode 100644 index 000000000000..d688ad66c35a --- /dev/null +++ b/sdk/search/azure-search-documents/tests/recordings/test_service_live.test_run_indexer.yaml @@ -0,0 +1,293 @@ +interactions: +- request: + body: 'b''{"name": "sample-datasource", "type": "azureblob", "credentials": {"connectionString": + "connection_string"}, "container": {"name": "searchcontainer"}}''' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '321' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 46F2314D8E0FDB67E7AB8379484C7D80 + method: POST + uri: https://searchf6ac0e10.search.windows.net/datasources?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf6ac0e10.search.windows.net/$metadata#datasources/$entity","@odata.etag":"\"0x8D7ED5160A7FF06\"","name":"sample-datasource","description":null,"type":"azureblob","subtype":null,"credentials":{"connectionString":null},"container":{"name":"searchcontainer","query":null},"dataChangeDetectionPolicy":null,"dataDeletionDetectionPolicy":null}' + headers: + cache-control: + - no-cache + content-length: + - '370' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:46 GMT + elapsed-time: + - '29' + etag: + - W/"0x8D7ED5160A7FF06" + expires: + - '-1' + location: + - https://searchf6ac0e10.search.windows.net/datasources('sample-datasource')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 7c6fe9be-8b2d-11ea-ad55-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "hotels", "fields": [{"name": "hotelId", "type": "Edm.String", + "key": true, "searchable": false}]}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '107' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 46F2314D8E0FDB67E7AB8379484C7D80 + method: POST + uri: https://searchf6ac0e10.search.windows.net/indexes?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf6ac0e10.search.windows.net/$metadata#indexes/$entity","@odata.etag":"\"0x8D7ED5162298E08\"","name":"hotels","defaultScoringProfile":null,"fields":[{"name":"hotelId","type":"Edm.String","searchable":false,"filterable":true,"retrievable":true,"sortable":true,"facetable":true,"key":true,"indexAnalyzer":null,"searchAnalyzer":null,"analyzer":null,"synonymMaps":[]}],"scoringProfiles":[],"corsOptions":null,"suggesters":[],"analyzers":[],"tokenizers":[],"tokenFilters":[],"charFilters":[],"encryptionKey":null,"similarity":null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:48 GMT + elapsed-time: + - '2086' + etag: + - W/"0x8D7ED5162298E08" + expires: + - '-1' + location: + - https://searchf6ac0e10.search.windows.net/indexes('hotels')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 7cad8bf4-8b2d-11ea-ac77-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: '{"name": "sample-indexer", "dataSourceName": "sample-datasource", "targetIndexName": + "hotels", "disabled": false}' + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 46F2314D8E0FDB67E7AB8379484C7D80 + method: POST + uri: https://searchf6ac0e10.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf6ac0e10.search.windows.net/$metadata#indexers/$entity","@odata.etag":"\"0x8D7ED5162765C60\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}' + headers: + cache-control: + - no-cache + content-length: + - '362' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:49 GMT + elapsed-time: + - '181' + etag: + - W/"0x8D7ED5162765C60" + expires: + - '-1' + location: + - https://searchf6ac0e10.search.windows.net/indexers('sample-indexer')?api-version=2019-05-06-Preview + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 7e350d6e-8b2d-11ea-acce-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 46F2314D8E0FDB67E7AB8379484C7D80 + method: GET + uri: https://searchf6ac0e10.search.windows.net/indexers?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf6ac0e10.search.windows.net/$metadata#indexers","value":[{"@odata.etag":"\"0x8D7ED5162765C60\"","name":"sample-indexer","description":null,"dataSourceName":"sample-datasource","skillsetName":null,"targetIndexName":"hotels","disabled":false,"schedule":null,"parameters":null,"fieldMappings":[],"outputFieldMappings":[],"cache":null}]}' + headers: + cache-control: + - no-cache + content-length: + - '366' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:49 GMT + elapsed-time: + - '14' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 7e83e1ca-8b2d-11ea-9cad-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 46F2314D8E0FDB67E7AB8379484C7D80 + method: POST + uri: https://searchf6ac0e10.search.windows.net/indexers('sample-indexer')/search.run?api-version=2019-05-06-Preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 30 Apr 2020 21:56:49 GMT + elapsed-time: + - '32' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 7ea7941a-8b2d-11ea-95d9-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json;odata.metadata=minimal + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-search-documents/1.0.0b3 Python/3.7.3 (Windows-10-10.0.17763-SP0) + api-key: + - 46F2314D8E0FDB67E7AB8379484C7D80 + method: GET + uri: https://searchf6ac0e10.search.windows.net/indexers('sample-indexer')/search.status?api-version=2019-05-06-Preview + response: + body: + string: '{"@odata.context":"https://searchf6ac0e10.search.windows.net/$metadata#Microsoft.Azure.Search.V2019_05_06_Preview.IndexerExecutionInfo","name":"sample-indexer","status":"running","lastResult":null,"executionHistory":[],"limits":{"maxRunTime":"PT0S","maxDocumentExtractionSize":0,"maxDocumentContentCharactersToExtract":0}}' + headers: + cache-control: + - no-cache + content-length: + - '322' + content-type: + - application/json; odata.metadata=minimal + date: + - Thu, 30 Apr 2020 21:56:49 GMT + elapsed-time: + - '11' + expires: + - '-1' + odata-version: + - '4.0' + pragma: + - no-cache + preference-applied: + - odata.include-annotations="*" + request-id: + - 7ec283d0-8b2d-11ea-80c9-2816a845e8c6 + strict-transport-security: + - max-age=15724800; includeSubDomains + vary: + - Accept-Encoding + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/search/azure-search-documents/tests/test_service_live.py b/sdk/search/azure-search-documents/tests/test_service_live.py index 7fc774b2d25a..947ce3a85c88 100644 --- a/sdk/search/azure-search-documents/tests/test_service_live.py +++ b/sdk/search/azure-search-documents/tests/test_service_live.py @@ -30,6 +30,7 @@ Skillset, DataSourceCredentials, DataSource, + Indexer, DataContainer, SynonymMap, SimpleField, @@ -615,3 +616,148 @@ def test_delete_datasource_string_if_unchanged(self, api_key, endpoint, index_na data_source.e_tag = etag # reset to the original datasource with pytest.raises(ValueError): client.delete_datasource(data_source.name, match_condition=MatchConditions.IfNotModified) + + +class SearchIndexersClientTest(AzureMgmtTestCase): + + def _prepare_indexer(self, endpoint, api_key, name="sample-indexer", ds_name="sample-datasource", id_name="hotels"): + con_str = self.settings.AZURE_STORAGE_CONNECTION_STRING + self.scrubber.register_name_pair(con_str, 'connection_string') + credentials = DataSourceCredentials(connection_string=con_str) + container = DataContainer(name='searchcontainer') + data_source = DataSource( + name=ds_name, + type="azureblob", + credentials=credentials, + container=container + ) + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)) + ds = client.get_datasources_client().create_datasource(data_source) + + index_name = id_name + fields = [ + { + "name": "hotelId", + "type": "Edm.String", + "key": True, + "searchable": False + }] + index = Index(name=index_name, fields=fields) + ind = client.get_indexes_client().create_index(index) + return Indexer(name=name, data_source_name=ds.name, target_index_name=ind.name) + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_create_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + result = client.create_indexer(indexer) + assert result.name == "sample-indexer" + assert result.target_index_name == "hotels" + assert result.data_source_name == "sample-datasource" + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_delete_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + result = client.create_indexer(indexer) + assert len(client.get_indexers()) == 1 + client.delete_indexer("sample-indexer") + assert len(client.get_indexers()) == 0 + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_reset_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + result = client.create_indexer(indexer) + assert len(client.get_indexers()) == 1 + result = client.reset_indexer("sample-indexer") + assert client.get_indexer_status("sample-indexer").last_result.status in ('InProgress', 'reset') + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_run_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + result = client.create_indexer(indexer) + assert len(client.get_indexers()) == 1 + start = time.time() + client.run_indexer("sample-indexer") + assert client.get_indexer_status("sample-indexer").status == 'running' + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_get_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + created = client.create_indexer(indexer) + result = client.get_indexer("sample-indexer") + assert result.name == "sample-indexer" + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_list_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer1 = self._prepare_indexer(endpoint, api_key) + indexer2 = self._prepare_indexer(endpoint, api_key, name="another-indexer", ds_name="another-datasource", id_name="another-index") + created1 = client.create_indexer(indexer1) + created2 = client.create_indexer(indexer2) + result = client.get_indexers() + assert isinstance(result, list) + assert set(x.name for x in result) == {"sample-indexer", "another-indexer"} + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_create_or_update_indexer(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + created = client.create_indexer(indexer) + assert len(client.get_indexers()) == 1 + indexer.description = "updated" + client.create_or_update_indexer(indexer) + assert len(client.get_indexers()) == 1 + result = client.get_indexer("sample-indexer") + assert result.name == "sample-indexer" + assert result.description == "updated" + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_get_indexer_status(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + result = client.create_indexer(indexer) + status = client.get_indexer_status("sample-indexer") + assert status.status is not None + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_create_or_update_indexer_if_unchanged(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + created = client.create_indexer(indexer) + etag = created.e_tag + + + indexer.description = "updated" + client.create_or_update_indexer(indexer) + + indexer.e_tag = etag + with pytest.raises(HttpResponseError): + client.create_or_update_indexer(indexer, match_condition=MatchConditions.IfNotModified) + + @SearchResourceGroupPreparer(random_name_enabled=True) + @SearchServicePreparer(schema=SCHEMA, index_batch=BATCH) + def test_delete_indexer_if_unchanged(self, api_key, endpoint, index_name, **kwargs): + client = SearchServiceClient(endpoint, AzureKeyCredential(api_key)).get_indexers_client() + indexer = self._prepare_indexer(endpoint, api_key) + result = client.create_indexer(indexer) + etag = result.e_tag + + indexer.description = "updated" + client.create_or_update_indexer(indexer) + + indexer.e_tag = etag + with pytest.raises(HttpResponseError): + client.delete_indexer(indexer, match_condition=MatchConditions.IfNotModified) diff --git a/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py b/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py index 73055280acb9..d3db2a68ce63 100644 --- a/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py +++ b/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py @@ -30,6 +30,7 @@ ACTIVE_DIRECTORY_TENANT_ID = '00000000-0000-0000-0000-000000000000' IS_SERVER_SIDE_FILE_ENCRYPTION_ENABLED = True ENABLE_LOGGING = True +AZURE_STORAGE_CONNECTION_STRING = 'DefaultEndpointsProtocol=https;AccountName=storagename;AccountKey=NzhL3hKZbJBuJ2484dPTR+xF30kYaWSSCbs2BzLgVVI1woqeST/1IgqaLm6QAOTxtGvxctSNbIR/1hW8yH+bJg==;EndpointSuffix=core.windows.net' # Read for details of this file: # https://github.com/Azure/azure-sdk-for-python/wiki/Contributing-to-the-tests