Skip to content

Commit 756b8bf

Browse files
author
SDKAuto
committed
CodeGen from PR 34217 in Azure/azure-rest-api-specs
Merge 396e2293b1fad3a1706432b1bbe50dcfa4619e0f into e86c472ddf827a6d6c410aaf3877dcc922205de7
1 parent 0a2bd99 commit 756b8bf

File tree

106 files changed

+10086
-1555
lines changed

Some content is hidden

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

106 files changed

+10086
-1555
lines changed

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

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

3+
## 10.0.0b2 (2025-04-24)
4+
5+
### Features Added
6+
7+
- Client `AdvisorManagementClient` added method `predict`
8+
- Client `AdvisorManagementClient` added operation group `advisor_scores`
9+
- Client `AdvisorManagementClient` added operation group `assessments`
10+
- Client `AdvisorManagementClient` added operation group `assessment_types`
11+
- Client `AdvisorManagementClient` added operation group `workloads`
12+
- Client `AdvisorManagementClient` added operation group `resiliency_reviews`
13+
- Client `AdvisorManagementClient` added operation group `triage_recommendations`
14+
- Client `AdvisorManagementClient` added operation group `triage_resources`
15+
- Model `ConfigData` added property `duration`
16+
- Model `ConfigData` added property `system_data`
17+
- Model `Resource` added property `system_data`
18+
- Model `ResourceRecommendationBase` added property `risk`
19+
- Model `ResourceRecommendationBase` added property `tracked`
20+
- Model `ResourceRecommendationBase` added property `tracked_properties`
21+
- Model `ResourceRecommendationBase` added property `review`
22+
- Model `ResourceRecommendationBase` added property `resource_workload`
23+
- Model `ResourceRecommendationBase` added property `source_system`
24+
- Model `ResourceRecommendationBase` added property `notes`
25+
- Model `ResourceRecommendationBase` added property `system_data`
26+
- Model `SuppressionContract` added property `system_data`
27+
- Added model `AdvisorScoreEntity`
28+
- Added model `AdvisorScoreEntityProperties`
29+
- Added model `AdvisorScoreResponse`
30+
- Added enum `Aggregated`
31+
- Added model `AssessmentListResult`
32+
- Added model `AssessmentResult`
33+
- Added model `AssessmentTypeListResult`
34+
- Added model `AssessmentTypeResult`
35+
- Added enum `CreatedByType`
36+
- Added enum `Duration`
37+
- Added model `ErrorAdditionalInfo`
38+
- Added model `ErrorDetail`
39+
- Added model `ErrorResponse`
40+
- Added model `PredictionRequest`
41+
- Added model `PredictionResponse`
42+
- Added enum `PredictionType`
43+
- Added enum `Priority`
44+
- Added enum `PriorityName`
45+
- Added model `ProxyResource`
46+
- Added enum `Reason`
47+
- Added enum `ReasonForRejectionName`
48+
- Added model `RecommendationPropertiesResourceWorkload`
49+
- Added model `RecommendationPropertiesReview`
50+
- Added model `RecommendationRejectBody`
51+
- Added enum `RecommendationStatusName`
52+
- Added model `ResiliencyReview`
53+
- Added model `ResiliencyReviewCollection`
54+
- Added enum `ReviewStatus`
55+
- Added enum `Risk`
56+
- Added model `ScoreEntity`
57+
- Added enum `State`
58+
- Added model `SystemData`
59+
- Added model `TimeSeriesEntityItem`
60+
- Added model `TrackedRecommendationProperties`
61+
- Added model `TrackedRecommendationPropertiesPayload`
62+
- Added model `TrackedRecommendationPropertiesPayloadProperties`
63+
- Added model `TriageRecommendation`
64+
- Added model `TriageRecommendationCollection`
65+
- Added model `TriageResource`
66+
- Added model `TriageResourceCollection`
67+
- Added model `WorkloadListResult`
68+
- Added model `WorkloadResult`
69+
- Model `RecommendationsOperations` added method `patch`
70+
- Added model `AdvisorManagementClientOperationsMixin`
71+
- Added model `AdvisorScoresOperations`
72+
- Added model `AssessmentTypesOperations`
73+
- Added model `AssessmentsOperations`
74+
- Added model `ResiliencyReviewsOperations`
75+
- Added model `TriageRecommendationsOperations`
76+
- Added model `TriageResourcesOperations`
77+
- Added model `WorkloadsOperations`
78+
- Method `AdvisorManagementClient.predict` has a new overload `def predict(self: None, prediction_request: PredictionRequest, content_type: str)`
79+
- Method `AdvisorManagementClient.predict` has a new overload `def predict(self: None, prediction_request: IO[bytes], content_type: str)`
80+
- Method `ConfigurationsOperations.create_in_resource_group` has a new overload `def create_in_resource_group(self: None, configuration_name: Union[str, ConfigurationName], resource_group: str, config_contract: IO[bytes], content_type: str)`
81+
- Method `ConfigurationsOperations.create_in_subscription` has a new overload `def create_in_subscription(self: None, configuration_name: Union[str, ConfigurationName], config_contract: IO[bytes], content_type: str)`
82+
- Method `RecommendationsOperations.patch` has a new overload `def patch(self: None, resource_uri: str, recommendation_id: str, tracked_properties: TrackedRecommendationPropertiesPayload, content_type: str)`
83+
- Method `RecommendationsOperations.patch` has a new overload `def patch(self: None, resource_uri: str, recommendation_id: str, tracked_properties: IO[bytes], content_type: str)`
84+
- Method `SuppressionsOperations.create` has a new overload `def create(self: None, resource_uri: str, recommendation_id: str, name: str, suppression_contract: IO[bytes], content_type: str)`
85+
- Method `AdvisorManagementClientOperationsMixin.predict` has a new overload `def predict(self: None, prediction_request: PredictionRequest, content_type: str)`
86+
- Method `AdvisorManagementClientOperationsMixin.predict` has a new overload `def predict(self: None, prediction_request: IO[bytes], content_type: str)`
87+
- Method `AssessmentsOperations.put` has a new overload `def put(self: None, assessment_name: str, assessment_contract: AssessmentResult, content_type: str)`
88+
- Method `AssessmentsOperations.put` has a new overload `def put(self: None, assessment_name: str, assessment_contract: IO[bytes], content_type: str)`
89+
- Method `TriageRecommendationsOperations.reject_triage_recommendation` has a new overload `def reject_triage_recommendation(self: None, review_id: str, recommendation_id: str, recommendation_reject_body: RecommendationRejectBody, content_type: str)`
90+
- Method `TriageRecommendationsOperations.reject_triage_recommendation` has a new overload `def reject_triage_recommendation(self: None, review_id: str, recommendation_id: str, recommendation_reject_body: IO[bytes], content_type: str)`
91+
392
## 10.0.0b1 (2022-10-28)
493

594
### 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 Advisor Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.9+.
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/advisor)
17-
Code samples for this package can be found at [Advisor](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://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/advisor)
15+
- Python 3.9+ 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-advisor
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.advisor import AdvisorManagementClient
40+
import os
2641

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

46+
## Examples
2847

48+
Code samples for this package can be found at:
49+
- [Search Advisor](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": "e82a24def11ffc98cc263884f9f1742c99f2df5e",
2+
"commit": "3b8e9517d1ec602fd5099fbf1eb25e2ea078022a",
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.1",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.34.1",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/advisor/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 --tag=package-2020-01 --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/advisor/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.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/advisor/resource-manager/readme.md"
1111
}

sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/__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 ._advisor_management_client import AdvisorManagementClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._advisor_management_client import AdvisorManagementClient # 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 * # type: ignore # 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
"AdvisorManagementClient",
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/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_advisor_management_client.py

Lines changed: 82 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,40 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, TYPE_CHECKING
10+
from typing import Any, Optional, TYPE_CHECKING, cast
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.core.settings import settings
1316
from azure.mgmt.core import ARMPipelineClient
17+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
1419

15-
from . import models
20+
from . import models as _models
1621
from ._configuration import AdvisorManagementClientConfiguration
17-
from ._serialization import Deserializer, Serializer
22+
from ._utils.serialization import Deserializer, Serializer
1823
from .operations import (
24+
AdvisorManagementClientOperationsMixin,
25+
AdvisorScoresOperations,
26+
AssessmentTypesOperations,
27+
AssessmentsOperations,
1928
ConfigurationsOperations,
2029
Operations,
2130
RecommendationMetadataOperations,
2231
RecommendationsOperations,
32+
ResiliencyReviewsOperations,
2333
SuppressionsOperations,
34+
TriageRecommendationsOperations,
35+
TriageResourcesOperations,
36+
WorkloadsOperations,
2437
)
2538

2639
if TYPE_CHECKING:
27-
# pylint: disable=unused-import,ungrouped-imports
2840
from azure.core.credentials import TokenCredential
2941

3042

31-
class AdvisorManagementClient: # pylint: disable=client-accepts-api-version-keyword
43+
class AdvisorManagementClient(AdvisorManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes
3244
"""REST APIs for Azure Advisor.
3345
3446
:ivar recommendation_metadata: RecommendationMetadataOperations operations
@@ -42,30 +54,64 @@ class AdvisorManagementClient: # pylint: disable=client-accepts-api-version-key
4254
:vartype operations: azure.mgmt.advisor.operations.Operations
4355
:ivar suppressions: SuppressionsOperations operations
4456
:vartype suppressions: azure.mgmt.advisor.operations.SuppressionsOperations
57+
:ivar advisor_scores: AdvisorScoresOperations operations
58+
:vartype advisor_scores: azure.mgmt.advisor.operations.AdvisorScoresOperations
59+
:ivar assessments: AssessmentsOperations operations
60+
:vartype assessments: azure.mgmt.advisor.operations.AssessmentsOperations
61+
:ivar assessment_types: AssessmentTypesOperations operations
62+
:vartype assessment_types: azure.mgmt.advisor.operations.AssessmentTypesOperations
63+
:ivar workloads: WorkloadsOperations operations
64+
:vartype workloads: azure.mgmt.advisor.operations.WorkloadsOperations
65+
:ivar resiliency_reviews: ResiliencyReviewsOperations operations
66+
:vartype resiliency_reviews: azure.mgmt.advisor.operations.ResiliencyReviewsOperations
67+
:ivar triage_recommendations: TriageRecommendationsOperations operations
68+
:vartype triage_recommendations: azure.mgmt.advisor.operations.TriageRecommendationsOperations
69+
:ivar triage_resources: TriageResourcesOperations operations
70+
:vartype triage_resources: azure.mgmt.advisor.operations.TriageResourcesOperations
4571
:param credential: Credential needed for the client to connect to Azure. Required.
4672
:type credential: ~azure.core.credentials.TokenCredential
4773
:param subscription_id: The Azure subscription ID. Required.
4874
:type subscription_id: str
49-
:param base_url: Service URL. Default value is "https://management.azure.com".
75+
:param base_url: Service URL. Default value is None.
5076
:type base_url: str
51-
:keyword api_version: Api Version. Default value is "2020-01-01". Note that overriding this
52-
default value may result in unsupported behavior.
77+
:keyword api_version: Api Version. Default value is "2024-11-18-preview". Note that overriding
78+
this default value may result in unsupported behavior.
5379
:paramtype api_version: str
5480
"""
5581

5682
def __init__(
57-
self,
58-
credential: "TokenCredential",
59-
subscription_id: str,
60-
base_url: str = "https://management.azure.com",
61-
**kwargs: Any
83+
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
6284
) -> None:
85+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
86+
_endpoints = get_arm_endpoints(_cloud)
87+
if not base_url:
88+
base_url = _endpoints["resource_manager"]
89+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
6390
self._config = AdvisorManagementClientConfiguration(
64-
credential=credential, subscription_id=subscription_id, **kwargs
91+
credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs
6592
)
66-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6793

68-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
94+
_policies = kwargs.pop("policies", None)
95+
if _policies is None:
96+
_policies = [
97+
policies.RequestIdPolicy(**kwargs),
98+
self._config.headers_policy,
99+
self._config.user_agent_policy,
100+
self._config.proxy_policy,
101+
policies.ContentDecodePolicy(**kwargs),
102+
ARMAutoResourceProviderRegistrationPolicy(),
103+
self._config.redirect_policy,
104+
self._config.retry_policy,
105+
self._config.authentication_policy,
106+
self._config.custom_hook_policy,
107+
self._config.logging_policy,
108+
policies.DistributedTracingPolicy(**kwargs),
109+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
110+
self._config.http_logging_policy,
111+
]
112+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs)
113+
114+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
69115
self._serialize = Serializer(client_models)
70116
self._deserialize = Deserializer(client_models)
71117
self._serialize.client_side_validation = False
@@ -76,8 +122,23 @@ def __init__(
76122
self.recommendations = RecommendationsOperations(self._client, self._config, self._serialize, self._deserialize)
77123
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
78124
self.suppressions = SuppressionsOperations(self._client, self._config, self._serialize, self._deserialize)
125+
self.advisor_scores = AdvisorScoresOperations(self._client, self._config, self._serialize, self._deserialize)
126+
self.assessments = AssessmentsOperations(self._client, self._config, self._serialize, self._deserialize)
127+
self.assessment_types = AssessmentTypesOperations(
128+
self._client, self._config, self._serialize, self._deserialize
129+
)
130+
self.workloads = WorkloadsOperations(self._client, self._config, self._serialize, self._deserialize)
131+
self.resiliency_reviews = ResiliencyReviewsOperations(
132+
self._client, self._config, self._serialize, self._deserialize
133+
)
134+
self.triage_recommendations = TriageRecommendationsOperations(
135+
self._client, self._config, self._serialize, self._deserialize
136+
)
137+
self.triage_resources = TriageResourcesOperations(
138+
self._client, self._config, self._serialize, self._deserialize
139+
)
79140

80-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
141+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
81142
"""Runs the network request through the client's chained policies.
82143
83144
>>> from azure.core.rest import HttpRequest
@@ -97,17 +158,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
97158

98159
request_copy = deepcopy(request)
99160
request_copy.url = self._client.format_url(request_copy.url)
100-
return self._client.send_request(request_copy, **kwargs)
161+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
101162

102-
def close(self):
103-
# type: () -> None
163+
def close(self) -> None:
104164
self._client.close()
105165

106-
def __enter__(self):
107-
# type: () -> AdvisorManagementClient
166+
def __enter__(self) -> Self:
108167
self._client.__enter__()
109168
return self
110169

111-
def __exit__(self, *exc_details):
112-
# type: (Any) -> None
170+
def __exit__(self, *exc_details: Any) -> None:
113171
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)