7
7
# --------------------------------------------------------------------------
8
8
9
9
from copy import deepcopy
10
- from typing import Any , TYPE_CHECKING
10
+ from typing import Any , Optional , TYPE_CHECKING , cast
11
11
from typing_extensions import Self
12
12
13
13
from azure .core .pipeline import policies
14
14
from azure .core .rest import HttpRequest , HttpResponse
15
+ from azure .core .settings import settings
15
16
from azure .mgmt .core import ARMPipelineClient
16
17
from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18
+ from azure .mgmt .core .tools import get_arm_endpoints
17
19
18
20
from . import models as _models
19
21
from ._configuration import MonitorManagementClientConfiguration
20
- from ._serialization import Deserializer , Serializer
21
- from .operations import (
22
- ActionGroupsOperations ,
23
- ActivityLogAlertsOperations ,
24
- ActivityLogsOperations ,
25
- AlertRuleIncidentsOperations ,
26
- AutoscaleSettingsOperations ,
27
- BaselinesOperations ,
28
- DiagnosticSettingsCategoryOperations ,
29
- DiagnosticSettingsOperations ,
30
- EventCategoriesOperations ,
31
- GuestDiagnosticsSettingsAssociationOperations ,
32
- GuestDiagnosticsSettingsOperations ,
33
- LogProfilesOperations ,
34
- MetricAlertsOperations ,
35
- MetricAlertsStatusOperations ,
36
- MetricDefinitionsOperations ,
37
- MetricNamespacesOperations ,
38
- MetricsOperations ,
39
- Operations ,
40
- PredictiveMetricOperations ,
41
- PrivateEndpointConnectionsOperations ,
42
- PrivateLinkResourcesOperations ,
43
- PrivateLinkScopeOperationStatusOperations ,
44
- PrivateLinkScopedResourcesOperations ,
45
- PrivateLinkScopesOperations ,
46
- ScheduledQueryRulesOperations ,
47
- ServiceDiagnosticSettingsOperations ,
48
- SubscriptionDiagnosticSettingsOperations ,
49
- TenantActivityLogsOperations ,
50
- VMInsightsOperations ,
51
- )
22
+ from ._utils .serialization import Deserializer , Serializer
23
+ from .operations import MetricAlertsOperations
52
24
53
25
if TYPE_CHECKING :
54
26
from azure .core .credentials import TokenCredential
55
27
56
28
57
- class MonitorManagementClient : # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
29
+ class MonitorManagementClient :
58
30
"""Monitor Management Client.
59
31
60
- :ivar action_groups: ActionGroupsOperations operations
61
- :vartype action_groups: azure.mgmt.monitor.operations.ActionGroupsOperations
62
- :ivar activity_log_alerts: ActivityLogAlertsOperations operations
63
- :vartype activity_log_alerts: azure.mgmt.monitor.operations.ActivityLogAlertsOperations
64
- :ivar activity_logs: ActivityLogsOperations operations
65
- :vartype activity_logs: azure.mgmt.monitor.operations.ActivityLogsOperations
66
- :ivar tenant_activity_logs: TenantActivityLogsOperations operations
67
- :vartype tenant_activity_logs: azure.mgmt.monitor.operations.TenantActivityLogsOperations
68
- :ivar alert_rule_incidents: AlertRuleIncidentsOperations operations
69
- :vartype alert_rule_incidents: azure.mgmt.monitor.operations.AlertRuleIncidentsOperations
70
- :ivar autoscale_settings: AutoscaleSettingsOperations operations
71
- :vartype autoscale_settings: azure.mgmt.monitor.operations.AutoscaleSettingsOperations
72
- :ivar predictive_metric: PredictiveMetricOperations operations
73
- :vartype predictive_metric: azure.mgmt.monitor.operations.PredictiveMetricOperations
74
- :ivar baselines: BaselinesOperations operations
75
- :vartype baselines: azure.mgmt.monitor.operations.BaselinesOperations
76
- :ivar diagnostic_settings: DiagnosticSettingsOperations operations
77
- :vartype diagnostic_settings: azure.mgmt.monitor.operations.DiagnosticSettingsOperations
78
- :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations
79
- :vartype diagnostic_settings_category:
80
- azure.mgmt.monitor.operations.DiagnosticSettingsCategoryOperations
81
- :ivar event_categories: EventCategoriesOperations operations
82
- :vartype event_categories: azure.mgmt.monitor.operations.EventCategoriesOperations
83
- :ivar guest_diagnostics_settings: GuestDiagnosticsSettingsOperations operations
84
- :vartype guest_diagnostics_settings:
85
- azure.mgmt.monitor.operations.GuestDiagnosticsSettingsOperations
86
- :ivar guest_diagnostics_settings_association: GuestDiagnosticsSettingsAssociationOperations
87
- operations
88
- :vartype guest_diagnostics_settings_association:
89
- azure.mgmt.monitor.operations.GuestDiagnosticsSettingsAssociationOperations
90
- :ivar log_profiles: LogProfilesOperations operations
91
- :vartype log_profiles: azure.mgmt.monitor.operations.LogProfilesOperations
92
32
:ivar metric_alerts: MetricAlertsOperations operations
93
33
:vartype metric_alerts: azure.mgmt.monitor.operations.MetricAlertsOperations
94
- :ivar metric_alerts_status: MetricAlertsStatusOperations operations
95
- :vartype metric_alerts_status: azure.mgmt.monitor.operations.MetricAlertsStatusOperations
96
- :ivar metric_definitions: MetricDefinitionsOperations operations
97
- :vartype metric_definitions: azure.mgmt.monitor.operations.MetricDefinitionsOperations
98
- :ivar metric_namespaces: MetricNamespacesOperations operations
99
- :vartype metric_namespaces: azure.mgmt.monitor.operations.MetricNamespacesOperations
100
- :ivar metrics: MetricsOperations operations
101
- :vartype metrics: azure.mgmt.monitor.operations.MetricsOperations
102
- :ivar operations: Operations operations
103
- :vartype operations: azure.mgmt.monitor.operations.Operations
104
- :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations
105
- :vartype scheduled_query_rules: azure.mgmt.monitor.operations.ScheduledQueryRulesOperations
106
- :ivar service_diagnostic_settings: ServiceDiagnosticSettingsOperations operations
107
- :vartype service_diagnostic_settings:
108
- azure.mgmt.monitor.operations.ServiceDiagnosticSettingsOperations
109
- :ivar vm_insights: VMInsightsOperations operations
110
- :vartype vm_insights: azure.mgmt.monitor.operations.VMInsightsOperations
111
- :ivar private_link_scopes: PrivateLinkScopesOperations operations
112
- :vartype private_link_scopes: azure.mgmt.monitor.operations.PrivateLinkScopesOperations
113
- :ivar private_link_scope_operation_status: PrivateLinkScopeOperationStatusOperations operations
114
- :vartype private_link_scope_operation_status:
115
- azure.mgmt.monitor.operations.PrivateLinkScopeOperationStatusOperations
116
- :ivar private_link_resources: PrivateLinkResourcesOperations operations
117
- :vartype private_link_resources: azure.mgmt.monitor.operations.PrivateLinkResourcesOperations
118
- :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
119
- :vartype private_endpoint_connections:
120
- azure.mgmt.monitor.operations.PrivateEndpointConnectionsOperations
121
- :ivar private_link_scoped_resources: PrivateLinkScopedResourcesOperations operations
122
- :vartype private_link_scoped_resources:
123
- azure.mgmt.monitor.operations.PrivateLinkScopedResourcesOperations
124
- :ivar subscription_diagnostic_settings: SubscriptionDiagnosticSettingsOperations operations
125
- :vartype subscription_diagnostic_settings:
126
- azure.mgmt.monitor.operations.SubscriptionDiagnosticSettingsOperations
127
34
:param credential: Credential needed for the client to connect to Azure. Required.
128
35
:type credential: ~azure.core.credentials.TokenCredential
129
36
:param subscription_id: The ID of the target subscription. Required.
130
37
:type subscription_id: str
131
- :param base_url: Service URL. Default value is "https://management.azure.com" .
38
+ :param base_url: Service URL. Default value is None .
132
39
:type base_url: str
133
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
134
- Retry-After header is present.
40
+ :keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
41
+ this default value may result in unsupported behavior.
42
+ :paramtype api_version: str
135
43
"""
136
44
137
45
def __init__ (
138
- self ,
139
- credential : "TokenCredential" ,
140
- subscription_id : str ,
141
- base_url : str = "https://management.azure.com" ,
142
- ** kwargs : Any
46
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
143
47
) -> None :
48
+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
49
+ _endpoints = get_arm_endpoints (_cloud )
50
+ if not base_url :
51
+ base_url = _endpoints ["resource_manager" ]
52
+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
144
53
self ._config = MonitorManagementClientConfiguration (
145
- credential = credential , subscription_id = subscription_id , ** kwargs
54
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
146
55
)
56
+
147
57
_policies = kwargs .pop ("policies" , None )
148
58
if _policies is None :
149
59
_policies = [
@@ -162,83 +72,13 @@ def __init__(
162
72
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
163
73
self ._config .http_logging_policy ,
164
74
]
165
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
75
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
166
76
167
77
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
168
78
self ._serialize = Serializer (client_models )
169
79
self ._deserialize = Deserializer (client_models )
170
80
self ._serialize .client_side_validation = False
171
- self .action_groups = ActionGroupsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
172
- self .activity_log_alerts = ActivityLogAlertsOperations (
173
- self ._client , self ._config , self ._serialize , self ._deserialize
174
- )
175
- self .activity_logs = ActivityLogsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
176
- self .tenant_activity_logs = TenantActivityLogsOperations (
177
- self ._client , self ._config , self ._serialize , self ._deserialize
178
- )
179
- self .alert_rule_incidents = AlertRuleIncidentsOperations (
180
- self ._client , self ._config , self ._serialize , self ._deserialize
181
- )
182
- self .autoscale_settings = AutoscaleSettingsOperations (
183
- self ._client , self ._config , self ._serialize , self ._deserialize
184
- )
185
- self .predictive_metric = PredictiveMetricOperations (
186
- self ._client , self ._config , self ._serialize , self ._deserialize
187
- )
188
- self .baselines = BaselinesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
189
- self .diagnostic_settings = DiagnosticSettingsOperations (
190
- self ._client , self ._config , self ._serialize , self ._deserialize
191
- )
192
- self .diagnostic_settings_category = DiagnosticSettingsCategoryOperations (
193
- self ._client , self ._config , self ._serialize , self ._deserialize
194
- )
195
- self .event_categories = EventCategoriesOperations (
196
- self ._client , self ._config , self ._serialize , self ._deserialize
197
- )
198
- self .guest_diagnostics_settings = GuestDiagnosticsSettingsOperations (
199
- self ._client , self ._config , self ._serialize , self ._deserialize
200
- )
201
- self .guest_diagnostics_settings_association = GuestDiagnosticsSettingsAssociationOperations (
202
- self ._client , self ._config , self ._serialize , self ._deserialize
203
- )
204
- self .log_profiles = LogProfilesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
205
81
self .metric_alerts = MetricAlertsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
206
- self .metric_alerts_status = MetricAlertsStatusOperations (
207
- self ._client , self ._config , self ._serialize , self ._deserialize
208
- )
209
- self .metric_definitions = MetricDefinitionsOperations (
210
- self ._client , self ._config , self ._serialize , self ._deserialize
211
- )
212
- self .metric_namespaces = MetricNamespacesOperations (
213
- self ._client , self ._config , self ._serialize , self ._deserialize
214
- )
215
- self .metrics = MetricsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
216
- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
217
- self .scheduled_query_rules = ScheduledQueryRulesOperations (
218
- self ._client , self ._config , self ._serialize , self ._deserialize
219
- )
220
- self .service_diagnostic_settings = ServiceDiagnosticSettingsOperations (
221
- self ._client , self ._config , self ._serialize , self ._deserialize
222
- )
223
- self .vm_insights = VMInsightsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
224
- self .private_link_scopes = PrivateLinkScopesOperations (
225
- self ._client , self ._config , self ._serialize , self ._deserialize
226
- )
227
- self .private_link_scope_operation_status = PrivateLinkScopeOperationStatusOperations (
228
- self ._client , self ._config , self ._serialize , self ._deserialize
229
- )
230
- self .private_link_resources = PrivateLinkResourcesOperations (
231
- self ._client , self ._config , self ._serialize , self ._deserialize
232
- )
233
- self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
234
- self ._client , self ._config , self ._serialize , self ._deserialize
235
- )
236
- self .private_link_scoped_resources = PrivateLinkScopedResourcesOperations (
237
- self ._client , self ._config , self ._serialize , self ._deserialize
238
- )
239
- self .subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations (
240
- self ._client , self ._config , self ._serialize , self ._deserialize
241
- )
242
82
243
83
def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
244
84
"""Runs the network request through the client's chained policies.
0 commit comments