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) Python Code Generator.
5+ # Code generated by Microsoft (R) AutoRest Code Generator.
66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
1111from typing_extensions import Self
1212
1313from azure .core .pipeline import policies
1414from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1516from azure .mgmt .core import ARMPipelineClient
1617from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1719
18- from ._configuration import DatabaseWatcherMgmtClientConfiguration
19- from ._serialization import Deserializer , Serializer
20+ from . import models as _models
21+ from ._configuration import MicrosoftDatabaseWatcherConfiguration
22+ from ._utils .serialization import Deserializer , Serializer
2023from .operations import (
2124 AlertRuleResourcesOperations ,
2225 HealthValidationsOperations ,
3033 from azure .core .credentials import TokenCredential
3134
3235
33- class DatabaseWatcherMgmtClient :
34- """DatabaseWatcherMgmtClient .
36+ class MicrosoftDatabaseWatcher :
37+ """MicrosoftDatabaseWatcher .
3538
3639 :ivar operations: Operations operations
3740 :vartype operations: azure.mgmt.databasewatcher.operations.Operations
@@ -42,35 +45,36 @@ class DatabaseWatcherMgmtClient:
4245 azure.mgmt.databasewatcher.operations.AlertRuleResourcesOperations
4346 :ivar health_validations: HealthValidationsOperations operations
4447 :vartype health_validations: azure.mgmt.databasewatcher.operations.HealthValidationsOperations
45- :ivar targets: TargetsOperations operations
46- :vartype targets: azure.mgmt.databasewatcher.operations.TargetsOperations
4748 :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations
4849 :vartype shared_private_link_resources:
4950 azure.mgmt.databasewatcher.operations.SharedPrivateLinkResourcesOperations
50- :param credential: Credential used to authenticate requests to the service. Required.
51+ :ivar targets: TargetsOperations operations
52+ :vartype targets: azure.mgmt.databasewatcher.operations.TargetsOperations
53+ :param credential: Credential needed for the client to connect to Azure. Required.
5154 :type credential: ~azure.core.credentials.TokenCredential
5255 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5356 :type subscription_id: str
54- :param base_url: Service host . Default value is "https://management.azure.com" .
57+ :param base_url: Service URL . Default value is None .
5558 :type base_url: str
56- :keyword api_version: The API version to use for this operation . Default value is "2025-01-02".
57- Note that overriding this default value may result in unsupported behavior.
59+ :keyword api_version: Api Version . Default value is "2025-01-02". Note that overriding this
60+ default value may result in unsupported behavior.
5861 :paramtype api_version: str
5962 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6063 Retry-After header is present.
6164 """
6265
6366 def __init__ (
64- self ,
65- credential : "TokenCredential" ,
66- subscription_id : str ,
67- base_url : str = "https://management.azure.com" ,
68- ** kwargs : Any
67+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
6968 ) -> None :
70- _endpoint = "{endpoint}"
71- self ._config = DatabaseWatcherMgmtClientConfiguration (
72- credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
69+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
70+ _endpoints = get_arm_endpoints (_cloud )
71+ if not base_url :
72+ base_url = _endpoints ["resource_manager" ]
73+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
74+ self ._config = MicrosoftDatabaseWatcherConfiguration (
75+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
7376 )
77+
7478 _policies = kwargs .pop ("policies" , None )
7579 if _policies is None :
7680 _policies = [
@@ -89,10 +93,11 @@ def __init__(
8993 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
9094 self ._config .http_logging_policy ,
9195 ]
92- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
96+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
9397
94- self ._serialize = Serializer ()
95- self ._deserialize = Deserializer ()
98+ client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
99+ self ._serialize = Serializer (client_models )
100+ self ._deserialize = Deserializer (client_models )
96101 self ._serialize .client_side_validation = False
97102 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
98103 self .watchers = WatchersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
@@ -102,18 +107,18 @@ def __init__(
102107 self .health_validations = HealthValidationsOperations (
103108 self ._client , self ._config , self ._serialize , self ._deserialize
104109 )
105- self .targets = TargetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
106110 self .shared_private_link_resources = SharedPrivateLinkResourcesOperations (
107111 self ._client , self ._config , self ._serialize , self ._deserialize
108112 )
113+ self .targets = TargetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
109114
110- def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
115+ def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
111116 """Runs the network request through the client's chained policies.
112117
113118 >>> from azure.core.rest import HttpRequest
114119 >>> request = HttpRequest("GET", "https://www.example.org/")
115120 <HttpRequest [GET], url: 'https://www.example.org/'>
116- >>> response = client.send_request (request)
121+ >>> response = client._send_request (request)
117122 <HttpResponse: 200 OK>
118123
119124 For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -126,11 +131,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
126131 """
127132
128133 request_copy = deepcopy (request )
129- path_format_arguments = {
130- "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
131- }
132-
133- request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
134+ request_copy .url = self ._client .format_url (request_copy .url )
134135 return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
135136
136137 def close (self ) -> None :
0 commit comments