23
23
if TYPE_CHECKING :
24
24
# pylint:disable=unused-import,ungrouped-imports
25
25
from .._generated .models import SearchIndexer , SearchIndexerStatus
26
- from typing import Any , Dict , Optional , Sequence
26
+ from typing import Any , Optional , Sequence
27
27
from azure .core .credentials import AzureKeyCredential
28
28
29
29
30
- class SearchIndexerClient (HeadersMixin ):
30
+ class SearchIndexerClient (HeadersMixin ): # pylint: disable=R0904
31
31
"""A client to interact with Azure search service Indexers.
32
32
33
33
"""
@@ -67,7 +67,7 @@ async def create_indexer(self, indexer, **kwargs):
67
67
:param indexer: The definition of the indexer to create.
68
68
:type indexer: ~azure.search.documents.SearchIndexer
69
69
:return: The created SearchIndexer
70
- :rtype: dict
70
+ :rtype: ~azure.search.documents.indexes.models.SearchIndexer
71
71
72
72
.. admonition:: Example:
73
73
@@ -92,7 +92,7 @@ async def create_or_update_indexer(self, indexer, name=None, **kwargs):
92
92
:param indexer: The definition of the indexer to create or update.
93
93
:type indexer: ~azure.search.documents.SearchIndexer
94
94
:return: The created SearchIndexer
95
- :rtype: dict
95
+ :rtype: ~azure.search.documents.indexes.models.SearchIndexer
96
96
"""
97
97
kwargs ["headers" ] = self ._merge_client_headers (kwargs .get ("headers" ))
98
98
error_map , access_condition = get_access_conditions (
@@ -114,7 +114,7 @@ async def get_indexer(self, name, **kwargs):
114
114
:param name: The name of the indexer to retrieve.
115
115
:type name: str
116
116
:return: The SearchIndexer that is fetched.
117
- :rtype: dict
117
+ :rtype: ~azure.search.documents.indexes.models.SearchIndexer
118
118
119
119
.. admonition:: Example:
120
120
@@ -135,7 +135,7 @@ async def get_indexers(self, **kwargs):
135
135
"""Lists all indexers available for a search service.
136
136
137
137
:return: List of all the SearchIndexers.
138
- :rtype: `list[dict ]`
138
+ :rtype: `list[~azure.search.documents.indexes.models.SearchIndexer ]`
139
139
140
140
.. admonition:: Example:
141
141
@@ -150,6 +150,19 @@ async def get_indexers(self, **kwargs):
150
150
result = await self ._client .indexers .list (** kwargs )
151
151
return result .indexers
152
152
153
+ @distributed_trace_async
154
+ async def get_indexer_names (self , ** kwargs ):
155
+ # type: (**Any) -> Sequence[str]
156
+ """Lists all indexer names available for a search service.
157
+
158
+ :return: List of all the SearchIndexer names.
159
+ :rtype: `list[str]`
160
+
161
+ """
162
+ kwargs ["headers" ] = self ._merge_client_headers (kwargs .get ("headers" ))
163
+ result = await self ._client .indexers .list (** kwargs )
164
+ return [x .name for x in result .indexers ]
165
+
153
166
@distributed_trace_async
154
167
async def delete_indexer (self , indexer , ** kwargs ):
155
168
# type: (Union[str, SearchIndexer], **Any) -> None
@@ -384,13 +397,26 @@ async def get_data_source_connections(self, **kwargs):
384
397
result = await self ._client .data_sources .list (** kwargs )
385
398
return [unpack_search_indexer_data_source (x ) for x in result .data_sources ]
386
399
400
+ @distributed_trace_async
401
+ async def get_data_source_connection_names (self , ** kwargs ):
402
+ # type: (**Any) -> Sequence[str]
403
+ """Lists all data source connection names available for a search service.
404
+
405
+ :return: List of all the data source connection names.
406
+ :rtype: `list[str]`
407
+
408
+ """
409
+ kwargs ["headers" ] = self ._merge_client_headers (kwargs .get ("headers" ))
410
+ result = await self ._client .data_sources .list (** kwargs )
411
+ return [x .name for x in result .data_sources ]
412
+
387
413
@distributed_trace_async
388
414
async def get_skillsets (self , ** kwargs ):
389
415
# type: (**Any) -> List[SearchIndexerSkillset]
390
416
"""List the SearchIndexerSkillsets in an Azure Search service.
391
417
392
418
:return: List of SearchIndexerSkillsets
393
- :rtype: list[dict ]
419
+ :rtype: list[~azure.search.documents.indexes.models.SearchIndexerSkillset ]
394
420
:raises: ~azure.core.exceptions.HttpResponseError
395
421
396
422
.. admonition:: Example:
@@ -407,6 +433,20 @@ async def get_skillsets(self, **kwargs):
407
433
result = await self ._client .skillsets .list (** kwargs )
408
434
return result .skillsets
409
435
436
+ @distributed_trace_async
437
+ async def get_skillset_names (self , ** kwargs ):
438
+ # type: (**Any) -> List[str]
439
+ """List the SearchIndexerSkillset names in an Azure Search service.
440
+
441
+ :return: List of SearchIndexerSkillset names
442
+ :rtype: list[str]
443
+ :raises: ~azure.core.exceptions.HttpResponseError
444
+
445
+ """
446
+ kwargs ["headers" ] = self ._merge_client_headers (kwargs .get ("headers" ))
447
+ result = await self ._client .skillsets .list (** kwargs )
448
+ return [x .name for x in result .skillsets ]
449
+
410
450
@distributed_trace_async
411
451
async def get_skillset (self , name , ** kwargs ):
412
452
# type: (str, **Any) -> SearchIndexerSkillset
@@ -415,7 +455,7 @@ async def get_skillset(self, name, **kwargs):
415
455
:param name: The name of the SearchIndexerSkillset to get
416
456
:type name: str
417
457
:return: The retrieved SearchIndexerSkillset
418
- :rtype: dict
458
+ :rtype: ~azure.search.documents.indexes.models.SearchIndexerSkillset
419
459
:raises: :class:`~azure.core.exceptions.ResourceNotFoundError`
420
460
421
461
.. admonition:: Example:
@@ -476,7 +516,7 @@ async def create_skillset(self, name, skills, description, **kwargs):
476
516
:param description: A description for the SearchIndexerSkillset
477
517
:type description: Optional[str]
478
518
:return: The created SearchIndexerSkillset
479
- :rtype: dict
519
+ :rtype: ~azure.search.documents.indexes.models.SearchIndexerSkillset
480
520
481
521
.. admonition:: Example:
482
522
@@ -514,7 +554,7 @@ async def create_or_update_skillset(self, name, **kwargs):
514
554
:keyword match_condition: The match condition to use upon the etag
515
555
:type match_condition: ~azure.core.MatchConditions
516
556
:return: The created or updated SearchIndexerSkillset
517
- :rtype: dict
557
+ :rtype: ~azure.search.documents.indexes.models.SearchIndexerSkillset
518
558
519
559
If a `skillset` is passed in, any optional `skills`, or
520
560
`description` parameter values will override it.
0 commit comments