66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
9- from typing import TYPE_CHECKING
9+ from copy import deepcopy
10+ from typing import Any , TYPE_CHECKING
1011
12+ from azure .core .rest import HttpRequest , HttpResponse
1113from azure .mgmt .core import ARMPipelineClient
12- from msrest import Deserializer , Serializer
14+
15+ from . import models
16+ from ._configuration import SearchManagementClientConfiguration
17+ from ._serialization import Deserializer , Serializer
18+ from .operations import (
19+ AdminKeysOperations ,
20+ Operations ,
21+ PrivateEndpointConnectionsOperations ,
22+ PrivateLinkResourcesOperations ,
23+ QueryKeysOperations ,
24+ ServicesOperations ,
25+ )
1326
1427if TYPE_CHECKING :
1528 # pylint: disable=unused-import,ungrouped-imports
16- from typing import Any , Optional
17-
1829 from azure .core .credentials import TokenCredential
1930
20- from ._configuration import SearchManagementClientConfiguration
21- from .operations import Operations
22- from .operations import AdminKeysOperations
23- from .operations import QueryKeysOperations
24- from .operations import ServicesOperations
25- from .operations import PrivateLinkResourcesOperations
26- from .operations import PrivateEndpointConnectionsOperations
27- from .operations import SharedPrivateLinkResourcesOperations
28- from . import models
2931
30-
31- class SearchManagementClient (object ):
32+ class SearchManagementClient : # pylint: disable=client-accepts-api-version-keyword
3233 """Client that can be used to manage Azure Cognitive Search services and API keys.
3334
3435 :ivar operations: Operations operations
@@ -42,49 +43,70 @@ class SearchManagementClient(object):
4243 :ivar private_link_resources: PrivateLinkResourcesOperations operations
4344 :vartype private_link_resources: azure.mgmt.search.operations.PrivateLinkResourcesOperations
4445 :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
45- :vartype private_endpoint_connections: azure.mgmt.search.operations.PrivateEndpointConnectionsOperations
46- :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations
47- :vartype shared_private_link_resources: azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations
48- :param credential: Credential needed for the client to connect to Azure.
46+ :vartype private_endpoint_connections:
47+ azure.mgmt.search.operations.PrivateEndpointConnectionsOperations
48+ :param credential: Credential needed for the client to connect to Azure. Required.
4949 :type credential: ~azure.core.credentials.TokenCredential
50- :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal.
50+ :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can
51+ obtain this value from the Azure Resource Manager API or the portal. Required.
5152 :type subscription_id: str
52- :param str base_url: Service URL
53- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
53+ :param base_url: Service URL. Default value is "https://management.azure.com".
54+ :type base_url: str
55+ :keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this
56+ default value may result in unsupported behavior.
57+ :paramtype api_version: str
58+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
59+ Retry-After header is present.
5460 """
5561
5662 def __init__ (
5763 self ,
58- credential , # type: "TokenCredential"
59- subscription_id , # type: str
60- base_url = None , # type: Optional[str]
61- ** kwargs # type: Any
62- ):
63- # type: (...) -> None
64- if not base_url :
65- base_url = 'https://management.azure.com'
66- self ._config = SearchManagementClientConfiguration (credential , subscription_id , ** kwargs )
64+ credential : "TokenCredential" ,
65+ subscription_id : str ,
66+ base_url : str = "https://management.azure.com" ,
67+ ** kwargs : Any
68+ ) -> None :
69+ self ._config = SearchManagementClientConfiguration (
70+ credential = credential , subscription_id = subscription_id , ** kwargs
71+ )
6772 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
6873
6974 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
7075 self ._serialize = Serializer (client_models )
71- self ._serialize .client_side_validation = False
7276 self ._deserialize = Deserializer (client_models )
73-
74- self .operations = Operations (
75- self ._client , self ._config , self ._serialize , self ._deserialize )
76- self .admin_keys = AdminKeysOperations (
77- self ._client , self ._config , self ._serialize , self ._deserialize )
78- self .query_keys = QueryKeysOperations (
79- self ._client , self ._config , self ._serialize , self ._deserialize )
80- self .services = ServicesOperations (
81- self ._client , self ._config , self ._serialize , self ._deserialize )
77+ self ._serialize .client_side_validation = False
78+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
79+ self .admin_keys = AdminKeysOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
80+ self .query_keys = QueryKeysOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
81+ self .services = ServicesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
8282 self .private_link_resources = PrivateLinkResourcesOperations (
83- self ._client , self ._config , self ._serialize , self ._deserialize )
83+ self ._client , self ._config , self ._serialize , self ._deserialize
84+ )
8485 self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
85- self ._client , self ._config , self ._serialize , self ._deserialize )
86- self .shared_private_link_resources = SharedPrivateLinkResourcesOperations (
87- self ._client , self ._config , self ._serialize , self ._deserialize )
86+ self ._client , self ._config , self ._serialize , self ._deserialize
87+ )
88+
89+ def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
90+ """Runs the network request through the client's chained policies.
91+
92+ >>> from azure.core.rest import HttpRequest
93+ >>> request = HttpRequest("GET", "https://www.example.org/")
94+ <HttpRequest [GET], url: 'https://www.example.org/'>
95+ >>> response = client._send_request(request)
96+ <HttpResponse: 200 OK>
97+
98+ For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
99+
100+ :param request: The network request you want to make. Required.
101+ :type request: ~azure.core.rest.HttpRequest
102+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
103+ :return: The response of your network call. Does not do error handling on your response.
104+ :rtype: ~azure.core.rest.HttpResponse
105+ """
106+
107+ request_copy = deepcopy (request )
108+ request_copy .url = self ._client .format_url (request_copy .url )
109+ return self ._client .send_request (request_copy , ** kwargs )
88110
89111 def close (self ):
90112 # type: () -> None
0 commit comments