Skip to content

Commit 4f2e0ba

Browse files
author
SDKAuto
committed
CodeGen from PR 33506 in Azure/azure-rest-api-specs
Merge 33943fb2070b530aae9f53451658c42084acbdf2 into 0c62abad8eabfcba5c50a0dfdc5778d86bab2130
1 parent dcd6719 commit 4f2e0ba

File tree

93 files changed

+9809
-2046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+9809
-2046
lines changed

sdk/alertsmanagement/azure-mgmt-alertsmanagement/CHANGELOG.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,104 @@
11
# Release History
22

3+
## 2.0.0b3 (2025-03-27)
4+
5+
### Features Added
6+
7+
- Client `AlertsManagementClient` added operation group `alert_rule_recommendations`
8+
- Client `AlertsManagementClient` added operation group `issue`
9+
- Model `Essentials` added property `has_enrichments`
10+
- Model `Essentials` added property `is_stateful_alert`
11+
- Model `Essentials` added property `correlation_details`
12+
- Enum `MonitorService` added member `RESOURCE_HEALTH`
13+
- Model `Resource` added property `system_data`
14+
- Added enum `AddedByType`
15+
- Added model `AlertEnrichmentItem`
16+
- Added model `AlertEnrichmentProperties`
17+
- Added model `AlertEnrichmentResponse`
18+
- Added model `AlertEnrichmentsList`
19+
- Added model `AlertRuleRecommendationResource`
20+
- Added model `AlertRuleRecommendationsListResponse`
21+
- Added model `CorrelationDetails`
22+
- Added model `ErrorDetailAutoGenerated`
23+
- Added model `ErrorDetailAutoGenerated2`
24+
- Added model `ErrorResponseAutoGenerated4`
25+
- Added model `ErrorResponseAutoGenerated5`
26+
- Added model `FetchInvestigationResultParameters`
27+
- Added enum `InvestigationEntityType`
28+
- Added model `InvestigationExecution`
29+
- Added enum `InvestigationExecutionRunState`
30+
- Added model `InvestigationMetadata`
31+
- Added model `InvestigationResult`
32+
- Added model `InvestigationScope`
33+
- Added model `IssueProperties`
34+
- Added model `IssuePropertiesUpdate`
35+
- Added model `IssueResource`
36+
- Added model `IssueResourceListResult`
37+
- Added model `IssueResourceUpdate`
38+
- Added model `ListParameter`
39+
- Added enum `MetricAlertsDisplayUnit`
40+
- Added model `Origin`
41+
- Added model `PagedRelatedAlert`
42+
- Added model `PagedRelatedResource`
43+
- Added model `PrometheusEnrichmentItem`
44+
- Added model `PrometheusInstantQuery`
45+
- Added model `PrometheusRangeQuery`
46+
- Added model `PrometheusRuleGroupResourcePatchParameters`
47+
- Added model `ProxyResource`
48+
- Added model `ProxyResourceAutoGenerated`
49+
- Added model `RelatedAlert`
50+
- Added model `RelatedAlerts`
51+
- Added model `RelatedResource`
52+
- Added model `RelatedResources`
53+
- Added enum `Relevance`
54+
- Added model `ResourceAutoGenerated2`
55+
- Added model `ResourceAutoGenerated3`
56+
- Added enum `ResourceProvisioningState`
57+
- Added model `RuleArmTemplate`
58+
- Added model `RunParameters`
59+
- Added model `StartInvestigationParameters`
60+
- Added enum `Status`
61+
- Added enum `Type`
62+
- Model `AlertsOperations` added method `get_enrichments`
63+
- Model `AlertsOperations` added method `list_enrichments`
64+
- Added model `AlertRuleRecommendationsOperations`
65+
- Added model `IssueOperations`
66+
- Method `AlertProcessingRulesOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, alert_processing_rule_name: str, alert_processing_rule: IO[bytes], content_type: str)`
67+
- Method `AlertProcessingRulesOperations.update` has a new overload `def update(self: None, resource_group_name: str, alert_processing_rule_name: str, alert_processing_rule_patch: IO[bytes], content_type: str)`
68+
- Method `AlertsOperations.change_state` has a new overload `def change_state(self: None, scope: str, alert_id: str, new_state: Union[str, AlertState], comment: Optional[Comments], content_type: str)`
69+
- Method `AlertsOperations.change_state` has a new overload `def change_state(self: None, scope: str, alert_id: str, new_state: Union[str, AlertState], comment: Optional[IO[bytes]], content_type: str)`
70+
- Method `PrometheusRuleGroupsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, rule_group_name: str, parameters: IO[bytes], content_type: str)`
71+
- Method `PrometheusRuleGroupsOperations.update` has a new overload `def update(self: None, resource_group_name: str, rule_group_name: str, parameters: PrometheusRuleGroupResourcePatchParameters, content_type: str)`
72+
- Method `PrometheusRuleGroupsOperations.update` has a new overload `def update(self: None, resource_group_name: str, rule_group_name: str, parameters: IO[bytes], content_type: str)`
73+
- Method `IssueOperations.add_or_update_alerts` has a new overload `def add_or_update_alerts(self: None, resource_uri: str, body: RelatedAlerts, content_type: str)`
74+
- Method `IssueOperations.add_or_update_alerts` has a new overload `def add_or_update_alerts(self: None, resource_uri: str, body: IO[bytes], content_type: str)`
75+
- Method `IssueOperations.add_or_update_resources` has a new overload `def add_or_update_resources(self: None, resource_uri: str, body: RelatedResources, content_type: str)`
76+
- Method `IssueOperations.add_or_update_resources` has a new overload `def add_or_update_resources(self: None, resource_uri: str, body: IO[bytes], content_type: str)`
77+
- Method `IssueOperations.create` has a new overload `def create(self: None, resource_uri: str, resource: IssueResource, content_type: str)`
78+
- Method `IssueOperations.create` has a new overload `def create(self: None, resource_uri: str, resource: IO[bytes], content_type: str)`
79+
- Method `IssueOperations.fetch_investigation_result` has a new overload `def fetch_investigation_result(self: None, resource_uri: str, body: FetchInvestigationResultParameters, content_type: str)`
80+
- Method `IssueOperations.fetch_investigation_result` has a new overload `def fetch_investigation_result(self: None, resource_uri: str, body: IO[bytes], content_type: str)`
81+
- Method `IssueOperations.list_alerts` has a new overload `def list_alerts(self: None, resource_uri: str, body: ListParameter, content_type: str)`
82+
- Method `IssueOperations.list_alerts` has a new overload `def list_alerts(self: None, resource_uri: str, body: IO[bytes], content_type: str)`
83+
- Method `IssueOperations.list_resources` has a new overload `def list_resources(self: None, resource_uri: str, body: ListParameter, content_type: str)`
84+
- Method `IssueOperations.list_resources` has a new overload `def list_resources(self: None, resource_uri: str, body: IO[bytes], content_type: str)`
85+
- Method `IssueOperations.start_investigation` has a new overload `def start_investigation(self: None, resource_uri: str, body: StartInvestigationParameters, content_type: str)`
86+
- Method `IssueOperations.start_investigation` has a new overload `def start_investigation(self: None, resource_uri: str, body: IO[bytes], content_type: str)`
87+
- Method `IssueOperations.update` has a new overload `def update(self: None, resource_uri: str, properties: IssueResourceUpdate, content_type: str)`
88+
- Method `IssueOperations.update` has a new overload `def update(self: None, resource_uri: str, properties: IO[bytes], content_type: str)`
89+
90+
### Breaking Changes
91+
92+
- Method `AlertsManagementClient.__init__` inserted a `positional_or_keyword` parameter `issue_name`
93+
- Model `ResourceAutoGenerated` deleted or renamed its instance variable `system_data`
94+
- Deleted or renamed model `PrometheusRuleGroupResourcePatch`
95+
- Deleted or renamed model `PrometheusRuleGroupResourcePatchProperties`
96+
- Method `AlertsOperations.change_state` inserted a `positional_or_keyword` parameter `scope`
97+
- Method `AlertsOperations.get_all` inserted a `positional_or_keyword` parameter `scope`
98+
- Method `AlertsOperations.get_by_id` inserted a `positional_or_keyword` parameter `scope`
99+
- Method `AlertsOperations.get_history` inserted a `positional_or_keyword` parameter `scope`
100+
- Method `AlertsOperations.get_summary` inserted a `positional_or_keyword` parameter `scope`
101+
3102
## 2.0.0b2 (2022-12-26)
4103

5104
### Features Added
Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,61 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Alerts Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
88

99
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
1010

11-
# Usage
11+
## Getting started
1212

13+
### Prerequisites
1314

14-
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
17-
Code samples for this package can be found at [Alerts Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
18-
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
15+
- Python 3.8+ is required to use this package.
16+
- [Azure subscription](https://azure.microsoft.com/free/)
1917

18+
### Install the package
2019

21-
# Provide Feedback
20+
```bash
21+
pip install azure-mgmt-alertsmanagement
22+
pip install azure-identity
23+
```
2224

23-
If you encounter any bugs or have suggestions, please file an issue in the
24-
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
25-
section of the project.
25+
### Authentication
26+
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables.
28+
29+
- `AZURE_CLIENT_ID` for Azure client ID.
30+
- `AZURE_TENANT_ID` for Azure tenant ID.
31+
- `AZURE_CLIENT_SECRET` for Azure client secret.
32+
33+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
34+
35+
With above configuration, client can be authenticated by following code:
36+
37+
```python
38+
from azure.identity import DefaultAzureCredential
39+
from azure.mgmt.alertsmanagement import AlertsManagementClient
40+
import os
2641

42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = AlertsManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
2745

46+
## Examples
2847

48+
Code samples for this package can be found at:
49+
- [Search Alerts Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
51+
52+
53+
## Troubleshooting
54+
55+
## Next steps
56+
57+
## Provide Feedback
58+
59+
If you encounter any bugs or have suggestions, please file an issue in the
60+
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
61+
section of the project.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "e37a57df67daaa82f9c3758fc450bc8655812a08",
2+
"commit": "a53440393d039d8bdf7de0265011262b49c57fee",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.2.7",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.27.4",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/alertsmanagement/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/alertsmanagement/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/alertsmanagement/resource-manager/readme.md"
1111
}

sdk/alertsmanagement/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._alerts_management_client import AlertsManagementClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._alerts_management_client import AlertsManagementClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"AlertsManagementClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()

sdk/alertsmanagement/azure-mgmt-alertsmanagement/azure/mgmt/alertsmanagement/_alerts_management_client.py

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,33 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
1315
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1417

1518
from . import models as _models
1619
from ._configuration import AlertsManagementClientConfiguration
1720
from ._serialization import Deserializer, Serializer
1821
from .operations import (
1922
AlertProcessingRulesOperations,
23+
AlertRuleRecommendationsOperations,
2024
AlertsOperations,
25+
IssueOperations,
2126
Operations,
2227
PrometheusRuleGroupsOperations,
2328
SmartGroupsOperations,
2429
)
2530

2631
if TYPE_CHECKING:
27-
# pylint: disable=unused-import,ungrouped-imports
2832
from azure.core.credentials import TokenCredential
2933

3034

31-
class AlertsManagementClient: # pylint: disable=client-accepts-api-version-keyword
35+
class AlertsManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3236
"""AlertsManagement Client.
3337
34-
:ivar alert_processing_rules: AlertProcessingRulesOperations operations
35-
:vartype alert_processing_rules:
36-
azure.mgmt.alertsmanagement.operations.AlertProcessingRulesOperations
3738
:ivar prometheus_rule_groups: PrometheusRuleGroupsOperations operations
3839
:vartype prometheus_rule_groups:
3940
azure.mgmt.alertsmanagement.operations.PrometheusRuleGroupsOperations
@@ -43,8 +44,18 @@ class AlertsManagementClient: # pylint: disable=client-accepts-api-version-keyw
4344
:vartype alerts: azure.mgmt.alertsmanagement.operations.AlertsOperations
4445
:ivar smart_groups: SmartGroupsOperations operations
4546
:vartype smart_groups: azure.mgmt.alertsmanagement.operations.SmartGroupsOperations
47+
:ivar alert_rule_recommendations: AlertRuleRecommendationsOperations operations
48+
:vartype alert_rule_recommendations:
49+
azure.mgmt.alertsmanagement.operations.AlertRuleRecommendationsOperations
50+
:ivar alert_processing_rules: AlertProcessingRulesOperations operations
51+
:vartype alert_processing_rules:
52+
azure.mgmt.alertsmanagement.operations.AlertProcessingRulesOperations
53+
:ivar issue: IssueOperations operations
54+
:vartype issue: azure.mgmt.alertsmanagement.operations.IssueOperations
4655
:param credential: Credential needed for the client to connect to Azure. Required.
4756
:type credential: ~azure.core.credentials.TokenCredential
57+
:param issue_name: The name of the IssueResource. Required.
58+
:type issue_name: str
4859
:param subscription_id: The ID of the target subscription. Required.
4960
:type subscription_id: str
5061
:param base_url: Service URL. Default value is "https://management.azure.com".
@@ -54,30 +65,53 @@ class AlertsManagementClient: # pylint: disable=client-accepts-api-version-keyw
5465
def __init__(
5566
self,
5667
credential: "TokenCredential",
68+
issue_name: str,
5769
subscription_id: str,
5870
base_url: str = "https://management.azure.com",
5971
**kwargs: Any
6072
) -> None:
6173
self._config = AlertsManagementClientConfiguration(
62-
credential=credential, subscription_id=subscription_id, **kwargs
74+
credential=credential, issue_name=issue_name, subscription_id=subscription_id, **kwargs
6375
)
64-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
76+
_policies = kwargs.pop("policies", None)
77+
if _policies is None:
78+
_policies = [
79+
policies.RequestIdPolicy(**kwargs),
80+
self._config.headers_policy,
81+
self._config.user_agent_policy,
82+
self._config.proxy_policy,
83+
policies.ContentDecodePolicy(**kwargs),
84+
ARMAutoResourceProviderRegistrationPolicy(),
85+
self._config.redirect_policy,
86+
self._config.retry_policy,
87+
self._config.authentication_policy,
88+
self._config.custom_hook_policy,
89+
self._config.logging_policy,
90+
policies.DistributedTracingPolicy(**kwargs),
91+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
92+
self._config.http_logging_policy,
93+
]
94+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
6595

6696
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
6797
self._serialize = Serializer(client_models)
6898
self._deserialize = Deserializer(client_models)
6999
self._serialize.client_side_validation = False
70-
self.alert_processing_rules = AlertProcessingRulesOperations(
71-
self._client, self._config, self._serialize, self._deserialize
72-
)
73100
self.prometheus_rule_groups = PrometheusRuleGroupsOperations(
74101
self._client, self._config, self._serialize, self._deserialize
75102
)
76103
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
77104
self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize)
78105
self.smart_groups = SmartGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
106+
self.alert_rule_recommendations = AlertRuleRecommendationsOperations(
107+
self._client, self._config, self._serialize, self._deserialize
108+
)
109+
self.alert_processing_rules = AlertProcessingRulesOperations(
110+
self._client, self._config, self._serialize, self._deserialize
111+
)
112+
self.issue = IssueOperations(self._client, self._config, self._serialize, self._deserialize)
79113

80-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
114+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
81115
"""Runs the network request through the client's chained policies.
82116
83117
>>> from azure.core.rest import HttpRequest
@@ -97,14 +131,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
97131

98132
request_copy = deepcopy(request)
99133
request_copy.url = self._client.format_url(request_copy.url)
100-
return self._client.send_request(request_copy, **kwargs)
134+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
101135

102136
def close(self) -> None:
103137
self._client.close()
104138

105-
def __enter__(self) -> "AlertsManagementClient":
139+
def __enter__(self) -> Self:
106140
self._client.__enter__()
107141
return self
108142

109-
def __exit__(self, *exc_details) -> None:
143+
def __exit__(self, *exc_details: Any) -> None:
110144
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)