6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
# --------------------------------------------------------------------------
8
8
9
- from typing import TYPE_CHECKING
9
+ from copy import deepcopy
10
+ from typing import Any , Optional , TYPE_CHECKING
10
11
12
+ from azure .core .rest import HttpRequest , HttpResponse
11
13
from azure .mgmt .core import ARMPipelineClient
12
14
from msrest import Deserializer , Serializer
13
15
16
+ from . import models
17
+ from ._configuration import SearchManagementClientConfiguration
18
+ from .operations import AdminKeysOperations , Operations , PrivateEndpointConnectionsOperations , PrivateLinkResourcesOperations , QueryKeysOperations , ServicesOperations , SharedPrivateLinkResourcesOperations
19
+
14
20
if TYPE_CHECKING :
15
21
# pylint: disable=unused-import,ungrouped-imports
16
- from typing import Any , Optional
17
-
18
22
from azure .core .credentials import TokenCredential
19
23
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
29
-
30
-
31
- class SearchManagementClient (object ):
24
+ class SearchManagementClient :
32
25
"""Client that can be used to manage Azure Cognitive Search services and API keys.
33
26
34
27
:ivar operations: Operations operations
@@ -42,49 +35,70 @@ class SearchManagementClient(object):
42
35
:ivar private_link_resources: PrivateLinkResourcesOperations operations
43
36
:vartype private_link_resources: azure.mgmt.search.operations.PrivateLinkResourcesOperations
44
37
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
45
- :vartype private_endpoint_connections: azure.mgmt.search.operations.PrivateEndpointConnectionsOperations
38
+ :vartype private_endpoint_connections:
39
+ azure.mgmt.search.operations.PrivateEndpointConnectionsOperations
46
40
:ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations
47
- :vartype shared_private_link_resources: azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations
41
+ :vartype shared_private_link_resources:
42
+ azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations
48
43
:param credential: Credential needed for the client to connect to Azure.
49
44
: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.
45
+ :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can
46
+ obtain this value from the Azure Resource Manager API or the portal.
51
47
: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.
48
+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
49
+ :type base_url: str
50
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
51
+ Retry-After header is present.
54
52
"""
55
53
56
54
def __init__ (
57
55
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 )
56
+ credential : "TokenCredential" ,
57
+ subscription_id : str ,
58
+ base_url : str = "https://management.azure.com" ,
59
+ ** kwargs : Any
60
+ ) -> None :
61
+ self ._config = SearchManagementClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
67
62
self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
68
63
69
64
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
70
65
self ._serialize = Serializer (client_models )
71
- self ._serialize .client_side_validation = False
72
66
self ._deserialize = Deserializer (client_models )
67
+ self ._serialize .client_side_validation = False
68
+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
69
+ self .admin_keys = AdminKeysOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
70
+ self .query_keys = QueryKeysOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
71
+ self .services = ServicesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
72
+ self .private_link_resources = PrivateLinkResourcesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
73
+ self .private_endpoint_connections = PrivateEndpointConnectionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
74
+ self .shared_private_link_resources = SharedPrivateLinkResourcesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
75
+
76
+
77
+ def _send_request (
78
+ self ,
79
+ request , # type: HttpRequest
80
+ ** kwargs : Any
81
+ ) -> HttpResponse :
82
+ """Runs the network request through the client's chained policies.
83
+
84
+ >>> from azure.core.rest import HttpRequest
85
+ >>> request = HttpRequest("GET", "https://www.example.org/")
86
+ <HttpRequest [GET], url: 'https://www.example.org/'>
87
+ >>> response = client._send_request(request)
88
+ <HttpResponse: 200 OK>
89
+
90
+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
91
+
92
+ :param request: The network request you want to make. Required.
93
+ :type request: ~azure.core.rest.HttpRequest
94
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
95
+ :return: The response of your network call. Does not do error handling on your response.
96
+ :rtype: ~azure.core.rest.HttpResponse
97
+ """
73
98
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 )
82
- self .private_link_resources = PrivateLinkResourcesOperations (
83
- self ._client , self ._config , self ._serialize , self ._deserialize )
84
- 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 )
99
+ request_copy = deepcopy (request )
100
+ request_copy .url = self ._client .format_url (request_copy .url )
101
+ return self ._client .send_request (request_copy , ** kwargs )
88
102
89
103
def close (self ):
90
104
# type: () -> None
0 commit comments