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
1820from . import models as _models
1921from ._configuration import MonitorManagementClientConfiguration
20- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2123from .operations import (
2224 ActionGroupsOperations ,
2325 ActivityLogAlertsOperations ,
2426 ActivityLogsOperations ,
2527 AlertRuleIncidentsOperations ,
2628 AutoscaleSettingsOperations ,
29+ AzureMonitorWorkspacesOperations ,
2730 BaselinesOperations ,
2831 DiagnosticSettingsCategoryOperations ,
2932 DiagnosticSettingsOperations ,
3639 MetricDefinitionsOperations ,
3740 MetricNamespacesOperations ,
3841 MetricsOperations ,
42+ MonitorOperationsOperations ,
3943 Operations ,
4044 PredictiveMetricOperations ,
4145 PrivateEndpointConnectionsOperations ,
@@ -124,26 +128,33 @@ class MonitorManagementClient: # pylint: disable=client-accepts-api-version-key
124128 :ivar subscription_diagnostic_settings: SubscriptionDiagnosticSettingsOperations operations
125129 :vartype subscription_diagnostic_settings:
126130 azure.mgmt.monitor.operations.SubscriptionDiagnosticSettingsOperations
131+ :ivar azure_monitor_workspaces: AzureMonitorWorkspacesOperations operations
132+ :vartype azure_monitor_workspaces:
133+ azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations
134+ :ivar monitor_operations: MonitorOperationsOperations operations
135+ :vartype monitor_operations: azure.mgmt.monitor.operations.MonitorOperationsOperations
127136 :param credential: Credential needed for the client to connect to Azure. Required.
128137 :type credential: ~azure.core.credentials.TokenCredential
129138 :param subscription_id: The ID of the target subscription. Required.
130139 :type subscription_id: str
131- :param base_url: Service URL. Default value is "https://management.azure.com" .
140+ :param base_url: Service URL. Default value is None .
132141 :type base_url: str
133142 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
134143 Retry-After header is present.
135144 """
136145
137146 def __init__ (
138- self ,
139- credential : "TokenCredential" ,
140- subscription_id : str ,
141- base_url : str = "https://management.azure.com" ,
142- ** kwargs : Any
147+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
143148 ) -> None :
149+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
150+ _endpoints = get_arm_endpoints (_cloud )
151+ if not base_url :
152+ base_url = _endpoints ["resource_manager" ]
153+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
144154 self ._config = MonitorManagementClientConfiguration (
145- credential = credential , subscription_id = subscription_id , ** kwargs
155+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
146156 )
157+
147158 _policies = kwargs .pop ("policies" , None )
148159 if _policies is None :
149160 _policies = [
@@ -162,7 +173,7 @@ def __init__(
162173 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
163174 self ._config .http_logging_policy ,
164175 ]
165- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
176+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
166177
167178 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
168179 self ._serialize = Serializer (client_models )
@@ -239,6 +250,12 @@ def __init__(
239250 self .subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations (
240251 self ._client , self ._config , self ._serialize , self ._deserialize
241252 )
253+ self .azure_monitor_workspaces = AzureMonitorWorkspacesOperations (
254+ self ._client , self ._config , self ._serialize , self ._deserialize
255+ )
256+ self .monitor_operations = MonitorOperationsOperations (
257+ self ._client , self ._config , self ._serialize , self ._deserialize
258+ )
242259
243260 def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
244261 """Runs the network request through the client's chained policies.
0 commit comments