22# --------------------------------------------------------------------------
33# Copyright (c) Microsoft Corporation. All rights reserved.
44# Licensed under the MIT License. See License.txt in the project root for license information.
5- # Code generated by Microsoft (R) AutoRest Code Generator.
5+ # Code generated by Microsoft (R) Python Code Generator.
66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
1315from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1417
15- from . import models as _models
1618from ._configuration import MigrationDiscoverySapMgmtClientConfiguration
1719from ._serialization import Deserializer , Serializer
18- from .operations import Operations , SapDiscoverySitesOperations , SapInstancesOperations , ServerInstancesOperations
20+ from .operations import SAPDiscoverySitesOperations , SAPInstancesOperations , ServerInstancesOperations
1921
2022if TYPE_CHECKING :
21- # pylint: disable=unused-import,ungrouped-imports
2223 from azure .core .credentials import TokenCredential
2324
2425
25- class MigrationDiscoverySapMgmtClient : # pylint: disable=client-accepts-api-version-keyword
26+ class MigrationDiscoverySapMgmtClient :
2627 """SAP Migration client provides access to various operations for SAP Migration.
2728
28- :ivar sap_discovery_sites: SapDiscoverySitesOperations operations
29+ :ivar sap_discovery_sites: SAPDiscoverySitesOperations operations
2930 :vartype sap_discovery_sites:
30- azure.mgmt.migrationdiscoverysap.operations.SapDiscoverySitesOperations
31- :ivar sap_instances: SapInstancesOperations operations
32- :vartype sap_instances: azure.mgmt.migrationdiscoverysap.operations.SapInstancesOperations
31+ azure.mgmt.migrationdiscoverysap.operations.SAPDiscoverySitesOperations
32+ :ivar sap_instances: SAPInstancesOperations operations
33+ :vartype sap_instances: azure.mgmt.migrationdiscoverysap.operations.SAPInstancesOperations
3334 :ivar server_instances: ServerInstancesOperations operations
3435 :vartype server_instances:
3536 azure.mgmt.migrationdiscoverysap.operations.ServerInstancesOperations
36- :ivar operations: Operations operations
37- :vartype operations: azure.mgmt.migrationdiscoverysap.operations.Operations
38- :param credential: Credential needed for the client to connect to Azure. Required.
37+ :param credential: Credential used to authenticate requests to the service. Required.
3938 :type credential: ~azure.core.credentials.TokenCredential
40- :param subscription_id: The ID of the target subscription. Required.
39+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4140 :type subscription_id: str
42- :param base_url: Service URL . Default value is "https://management.azure.com".
41+ :param base_url: Service host . Default value is "https://management.azure.com".
4342 :type base_url: str
44- :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
45- this default value may result in unsupported behavior.
43+ :keyword api_version: The API version to use for this operation. Default value is
44+ "2023-10-01-preview". Note that overriding this default value may result in unsupported
45+ behavior.
4646 :paramtype api_version: str
4747 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4848 Retry-After header is present.
@@ -55,31 +55,48 @@ def __init__(
5555 base_url : str = "https://management.azure.com" ,
5656 ** kwargs : Any
5757 ) -> None :
58+ _endpoint = "{endpoint}"
5859 self ._config = MigrationDiscoverySapMgmtClientConfiguration (
59- credential = credential , subscription_id = subscription_id , ** kwargs
60+ credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
6061 )
61- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
62-
63- client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
64- self ._serialize = Serializer (client_models )
65- self ._deserialize = Deserializer (client_models )
62+ _policies = kwargs .pop ("policies" , None )
63+ if _policies is None :
64+ _policies = [
65+ policies .RequestIdPolicy (** kwargs ),
66+ self ._config .headers_policy ,
67+ self ._config .user_agent_policy ,
68+ self ._config .proxy_policy ,
69+ policies .ContentDecodePolicy (** kwargs ),
70+ ARMAutoResourceProviderRegistrationPolicy (),
71+ self ._config .redirect_policy ,
72+ self ._config .retry_policy ,
73+ self ._config .authentication_policy ,
74+ self ._config .custom_hook_policy ,
75+ self ._config .logging_policy ,
76+ policies .DistributedTracingPolicy (** kwargs ),
77+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
78+ self ._config .http_logging_policy ,
79+ ]
80+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
81+
82+ self ._serialize = Serializer ()
83+ self ._deserialize = Deserializer ()
6684 self ._serialize .client_side_validation = False
67- self .sap_discovery_sites = SapDiscoverySitesOperations (
85+ self .sap_discovery_sites = SAPDiscoverySitesOperations (
6886 self ._client , self ._config , self ._serialize , self ._deserialize
6987 )
70- self .sap_instances = SapInstancesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
88+ self .sap_instances = SAPInstancesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
7189 self .server_instances = ServerInstancesOperations (
7290 self ._client , self ._config , self ._serialize , self ._deserialize
7391 )
74- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
7592
76- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
93+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
7794 """Runs the network request through the client's chained policies.
7895
7996 >>> from azure.core.rest import HttpRequest
8097 >>> request = HttpRequest("GET", "https://www.example.org/")
8198 <HttpRequest [GET], url: 'https://www.example.org/'>
82- >>> response = client._send_request (request)
99+ >>> response = client.send_request (request)
83100 <HttpResponse: 200 OK>
84101
85102 For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -92,13 +109,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
92109 """
93110
94111 request_copy = deepcopy (request )
95- request_copy .url = self ._client .format_url (request_copy .url )
96- return self ._client .send_request (request_copy , ** kwargs )
112+ path_format_arguments = {
113+ "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
114+ }
115+
116+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
117+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
97118
98119 def close (self ) -> None :
99120 self ._client .close ()
100121
101- def __enter__ (self ) -> "MigrationDiscoverySapMgmtClient" :
122+ def __enter__ (self ) -> Self :
102123 self ._client .__enter__ ()
103124 return self
104125
0 commit comments