11# coding=utf-8
22# --------------------------------------------------------------------------
3- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/[email protected] ) 3+ # Copyright (c) Microsoft Corporation. All rights reserved.
4+ # Licensed under the MIT License. See License.txt in the project root for license information.
5+ # Code generated by Microsoft (R) Python Code Generator.
46# Changes may cause incorrect behavior and will be lost if the code is regenerated.
57# --------------------------------------------------------------------------
68
79from copy import deepcopy
8- from typing import Any
10+ from typing import Any , TYPE_CHECKING , Union
911from typing_extensions import Self
1012
1113from azure .core import PipelineClient
14+ from azure .core .credentials import AzureKeyCredential
1215from azure .core .pipeline import policies
1316from azure .core .rest import HttpRequest , HttpResponse
1417
15- from . import models as _models
16- from ._configuration import SearchServiceClientConfiguration
18+ from ._configuration import SearchClientConfiguration
1719from ._serialization import Deserializer , Serializer
1820from .operations import (
19- AliasesOperations ,
21+ AliasesOperationsOperations ,
2022 DataSourcesOperations ,
2123 IndexersOperations ,
2224 IndexesOperations ,
23- SearchServiceClientOperationsMixin ,
25+ SearchClientOperationsMixin ,
2426 SkillsetsOperations ,
2527 SynonymMapsOperations ,
2628)
2729
30+ if TYPE_CHECKING :
31+ from azure .core .credentials import TokenCredential
2832
29- class SearchServiceClient (SearchServiceClientOperationsMixin ): # pylint: disable=too-many-instance-attributes
33+
34+ class SearchClient (SearchClientOperationsMixin ): # pylint: disable=too-many-instance-attributes
3035 """Client that can be used to manage and query indexes and documents, as well as manage other
3136 resources, on a search service.
3237
3338 :ivar data_sources: DataSourcesOperations operations
34- :vartype data_sources: azure.search.documents.indexes. operations.DataSourcesOperations
39+ :vartype data_sources: azure.search.documents.operations.DataSourcesOperations
3540 :ivar indexers: IndexersOperations operations
36- :vartype indexers: azure.search.documents.indexes. operations.IndexersOperations
41+ :vartype indexers: azure.search.documents.operations.IndexersOperations
3742 :ivar skillsets: SkillsetsOperations operations
38- :vartype skillsets: azure.search.documents.indexes. operations.SkillsetsOperations
43+ :vartype skillsets: azure.search.documents.operations.SkillsetsOperations
3944 :ivar synonym_maps: SynonymMapsOperations operations
40- :vartype synonym_maps: azure.search.documents.indexes. operations.SynonymMapsOperations
45+ :vartype synonym_maps: azure.search.documents.operations.SynonymMapsOperations
4146 :ivar indexes: IndexesOperations operations
42- :vartype indexes: azure.search.documents.indexes. operations.IndexesOperations
43- :ivar aliases: AliasesOperations operations
44- :vartype aliases : azure.search.documents.indexes. operations.AliasesOperations
45- :param endpoint: The endpoint URL of the search service . Required.
47+ :vartype indexes: azure.search.documents.operations.IndexesOperations
48+ :ivar aliases_operations: AliasesOperationsOperations operations
49+ :vartype aliases_operations : azure.search.documents.operations.AliasesOperationsOperations
50+ :param endpoint: Service host . Required.
4651 :type endpoint: str
47- :keyword api_version: Api Version. Default value is "2024-11-01-preview". Note that overriding
48- this default value may result in unsupported behavior.
52+ :param credential: Credential used to authenticate requests to the service. Is either a key
53+ credential type or a token credential type. Required.
54+ :type credential: ~azure.core.credentials.AzureKeyCredential or
55+ ~azure.core.credentials.TokenCredential
56+ :keyword api_version: The API version to use for this operation. Default value is
57+ "2024-11-01-preview". Note that overriding this default value may result in unsupported
58+ behavior.
4959 :paramtype api_version: str
5060 """
5161
52- def __init__ ( # pylint: disable=missing-client-constructor-parameter-credential
53- self , endpoint : str , ** kwargs : Any
54- ) -> None :
62+ def __init__ (self , endpoint : str , credential : Union [AzureKeyCredential , "TokenCredential" ], ** kwargs : Any ) -> None :
5563 _endpoint = "{endpoint}"
56- self ._config = SearchServiceClientConfiguration (endpoint = endpoint , ** kwargs )
64+ self ._config = SearchClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
5765 _policies = kwargs .pop ("policies" , None )
5866 if _policies is None :
5967 _policies = [
@@ -73,24 +81,25 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
7381 ]
7482 self ._client : PipelineClient = PipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
7583
76- client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
77- self ._serialize = Serializer (client_models )
78- self ._deserialize = Deserializer (client_models )
84+ self ._serialize = Serializer ()
85+ self ._deserialize = Deserializer ()
7986 self ._serialize .client_side_validation = False
8087 self .data_sources = DataSourcesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
8188 self .indexers = IndexersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
8289 self .skillsets = SkillsetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
8390 self .synonym_maps = SynonymMapsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
8491 self .indexes = IndexesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
85- self .aliases = AliasesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
92+ self .aliases_operations = AliasesOperationsOperations (
93+ self ._client , self ._config , self ._serialize , self ._deserialize
94+ )
8695
87- def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
96+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
8897 """Runs the network request through the client's chained policies.
8998
9099 >>> from azure.core.rest import HttpRequest
91100 >>> request = HttpRequest("GET", "https://www.example.org/")
92101 <HttpRequest [GET], url: 'https://www.example.org/'>
93- >>> response = client._send_request (request)
102+ >>> response = client.send_request (request)
94103 <HttpResponse: 200 OK>
95104
96105 For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
0 commit comments