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
1518from . import models as _models
1619from ._configuration import AlertsManagementClientConfiguration
1720from ._serialization import Deserializer , Serializer
1821from .operations import (
1922 AlertProcessingRulesOperations ,
23+ AlertRuleRecommendationsOperations ,
2024 AlertsOperations ,
25+ IssueOperations ,
26+ MigrateFromSmartDetectionOperations ,
2127 Operations ,
2228 PrometheusRuleGroupsOperations ,
29+ SmartDetectorAlertRulesOperations ,
2330 SmartGroupsOperations ,
31+ TenantActivityLogAlertsOperations ,
2432)
2533
2634if TYPE_CHECKING :
27- # pylint: disable=unused-import,ungrouped-imports
2835 from azure .core .credentials import TokenCredential
2936
3037
31- class AlertsManagementClient : # pylint: disable=client-accepts-api-version-keyword
38+ class AlertsManagementClient : # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3239 """AlertsManagement Client.
3340
34- :ivar alert_processing_rules: AlertProcessingRulesOperations operations
35- :vartype alert_processing_rules:
36- azure.mgmt.alertsmanagement.operations.AlertProcessingRulesOperations
3741 :ivar prometheus_rule_groups: PrometheusRuleGroupsOperations operations
3842 :vartype prometheus_rule_groups:
3943 azure.mgmt.alertsmanagement.operations.PrometheusRuleGroupsOperations
@@ -43,41 +47,94 @@ class AlertsManagementClient: # pylint: disable=client-accepts-api-version-keyw
4347 :vartype alerts: azure.mgmt.alertsmanagement.operations.AlertsOperations
4448 :ivar smart_groups: SmartGroupsOperations operations
4549 :vartype smart_groups: azure.mgmt.alertsmanagement.operations.SmartGroupsOperations
50+ :ivar alert_rule_recommendations: AlertRuleRecommendationsOperations operations
51+ :vartype alert_rule_recommendations:
52+ azure.mgmt.alertsmanagement.operations.AlertRuleRecommendationsOperations
53+ :ivar alert_processing_rules: AlertProcessingRulesOperations operations
54+ :vartype alert_processing_rules:
55+ azure.mgmt.alertsmanagement.operations.AlertProcessingRulesOperations
56+ :ivar smart_detector_alert_rules: SmartDetectorAlertRulesOperations operations
57+ :vartype smart_detector_alert_rules:
58+ azure.mgmt.alertsmanagement.operations.SmartDetectorAlertRulesOperations
59+ :ivar migrate_from_smart_detection: MigrateFromSmartDetectionOperations operations
60+ :vartype migrate_from_smart_detection:
61+ azure.mgmt.alertsmanagement.operations.MigrateFromSmartDetectionOperations
62+ :ivar tenant_activity_log_alerts: TenantActivityLogAlertsOperations operations
63+ :vartype tenant_activity_log_alerts:
64+ azure.mgmt.alertsmanagement.operations.TenantActivityLogAlertsOperations
65+ :ivar issue: IssueOperations operations
66+ :vartype issue: azure.mgmt.alertsmanagement.operations.IssueOperations
4667 :param credential: Credential needed for the client to connect to Azure. Required.
4768 :type credential: ~azure.core.credentials.TokenCredential
69+ :param issue_name: The name of the IssueResource. Required.
70+ :type issue_name: str
4871 :param subscription_id: The ID of the target subscription. Required.
4972 :type subscription_id: str
5073 :param base_url: Service URL. Default value is "https://management.azure.com".
5174 :type base_url: str
75+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
76+ Retry-After header is present.
5277 """
5378
5479 def __init__ (
5580 self ,
5681 credential : "TokenCredential" ,
82+ issue_name : str ,
5783 subscription_id : str ,
5884 base_url : str = "https://management.azure.com" ,
5985 ** kwargs : Any
6086 ) -> None :
6187 self ._config = AlertsManagementClientConfiguration (
62- credential = credential , subscription_id = subscription_id , ** kwargs
88+ credential = credential , issue_name = issue_name , subscription_id = subscription_id , ** kwargs
6389 )
64- self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
90+ _policies = kwargs .pop ("policies" , None )
91+ if _policies is None :
92+ _policies = [
93+ policies .RequestIdPolicy (** kwargs ),
94+ self ._config .headers_policy ,
95+ self ._config .user_agent_policy ,
96+ self ._config .proxy_policy ,
97+ policies .ContentDecodePolicy (** kwargs ),
98+ ARMAutoResourceProviderRegistrationPolicy (),
99+ self ._config .redirect_policy ,
100+ self ._config .retry_policy ,
101+ self ._config .authentication_policy ,
102+ self ._config .custom_hook_policy ,
103+ self ._config .logging_policy ,
104+ policies .DistributedTracingPolicy (** kwargs ),
105+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
106+ self ._config .http_logging_policy ,
107+ ]
108+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
65109
66110 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
67111 self ._serialize = Serializer (client_models )
68112 self ._deserialize = Deserializer (client_models )
69113 self ._serialize .client_side_validation = False
70- self .alert_processing_rules = AlertProcessingRulesOperations (
71- self ._client , self ._config , self ._serialize , self ._deserialize
72- )
73114 self .prometheus_rule_groups = PrometheusRuleGroupsOperations (
74115 self ._client , self ._config , self ._serialize , self ._deserialize
75116 )
76117 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
77118 self .alerts = AlertsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
78119 self .smart_groups = SmartGroupsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
120+ self .alert_rule_recommendations = AlertRuleRecommendationsOperations (
121+ self ._client , self ._config , self ._serialize , self ._deserialize
122+ )
123+ self .alert_processing_rules = AlertProcessingRulesOperations (
124+ self ._client , self ._config , self ._serialize , self ._deserialize
125+ )
126+ self .smart_detector_alert_rules = SmartDetectorAlertRulesOperations (
127+ self ._client , self ._config , self ._serialize , self ._deserialize
128+ )
129+ self .migrate_from_smart_detection = MigrateFromSmartDetectionOperations (
130+ self ._client , self ._config , self ._serialize , self ._deserialize
131+ )
132+ self .tenant_activity_log_alerts = TenantActivityLogAlertsOperations (
133+ self ._client , self ._config , self ._serialize , self ._deserialize
134+ )
135+ self .issue = IssueOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
79136
80- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
137+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
81138 """Runs the network request through the client's chained policies.
82139
83140 >>> from azure.core.rest import HttpRequest
@@ -97,14 +154,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
97154
98155 request_copy = deepcopy (request )
99156 request_copy .url = self ._client .format_url (request_copy .url )
100- return self ._client .send_request (request_copy , ** kwargs )
157+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
101158
102159 def close (self ) -> None :
103160 self ._client .close ()
104161
105- def __enter__ (self ) -> "AlertsManagementClient" :
162+ def __enter__ (self ) -> Self :
106163 self ._client .__enter__ ()
107164 return self
108165
109- def __exit__ (self , * exc_details ) -> None :
166+ def __exit__ (self , * exc_details : Any ) -> None :
110167 self ._client .__exit__ (* exc_details )
0 commit comments