Skip to content

Commit 86c006c

Browse files
authored
code and test (#35362)
Co-authored-by: azure-sdk <PythonSdkPipelines>
1 parent 663c9d2 commit 86c006c

File tree

77 files changed

+1228
-1261
lines changed

Some content is hidden

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

77 files changed

+1228
-1261
lines changed

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

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

3+
## 2.2.0b2 (2024-05-20)
4+
5+
### Features Added
6+
7+
- Added operation group ScheduledEventOperations
8+
39
## 2.2.0b1 (2023-10-22)
410

511
### Features Added

sdk/maintenance/azure-mgmt-maintenance/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Maintenance 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_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.7+ is required to use this package.
15+
- Python 3.8+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "e6d90862a97c4f04f0c26a8869602bbfd8b10280",
2+
"commit": "f8b7c60c9839bc32fa19eb3d1d13069b70ba345d",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.9.7",
55
"use": [
6-
"@autorest/python@6.7.1",
7-
"@autorest/modelerfour@4.26.2"
6+
"@autorest/python@6.13.7",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/maintenance/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
9+
"autorest_command": "autorest specification/maintenance/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.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
1010
"readme": "specification/maintenance/resource-manager/readme.md"
1111
}

sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_configuration.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1413

@@ -19,25 +18,23 @@
1918
from azure.core.credentials import TokenCredential
2019

2120

22-
class MaintenanceManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
21+
class MaintenanceManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2322
"""Configuration for MaintenanceManagementClient.
2423
2524
Note that all parameters used to create this instance are saved as instance
2625
attributes.
2726
2827
:param credential: Credential needed for the client to connect to Azure. Required.
2928
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
31-
subscription. The subscription ID forms part of the URI for every service call. Required.
29+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3230
:type subscription_id: str
33-
:keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding
31+
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
3432
this default value may result in unsupported behavior.
3533
:paramtype api_version: str
3634
"""
3735

3836
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
39-
super(MaintenanceManagementClientConfiguration, self).__init__(**kwargs)
40-
api_version: str = kwargs.pop("api_version", "2023-09-01-preview")
37+
api_version: str = kwargs.pop("api_version", "2023-10-01-preview")
4138

4239
if credential is None:
4340
raise ValueError("Parameter 'credential' must not be None.")
@@ -49,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4946
self.api_version = api_version
5047
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5148
kwargs.setdefault("sdk_moniker", "mgmt-maintenance/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
5250
self._configure(**kwargs)
5351

5452
def _configure(self, **kwargs: Any) -> None:
@@ -57,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
5755
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5856
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5957
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
60-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6158
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6259
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6361
self.authentication_policy = kwargs.get("authentication_policy")
6462
if self.credential and not self.authentication_policy:
6563
self.authentication_policy = ARMChallengeAuthenticationPolicy(

sdk/maintenance/azure-mgmt-maintenance/azure/mgmt/maintenance/_maintenance_management_client.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
1111

12+
from azure.core.pipeline import policies
1213
from azure.core.rest import HttpRequest, HttpResponse
1314
from azure.mgmt.core import ARMPipelineClient
15+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1416

1517
from . import models as _models
1618
from ._configuration import MaintenanceManagementClientConfiguration
@@ -26,6 +28,7 @@
2628
MaintenanceConfigurationsOperations,
2729
Operations,
2830
PublicMaintenanceConfigurationsOperations,
31+
ScheduledEventOperations,
2932
UpdatesOperations,
3033
)
3134

@@ -37,6 +40,8 @@
3740
class MaintenanceManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3841
"""Azure Maintenance Management Client.
3942
43+
:ivar scheduled_event: ScheduledEventOperations operations
44+
:vartype scheduled_event: azure.mgmt.maintenance.operations.ScheduledEventOperations
4045
:ivar public_maintenance_configurations: PublicMaintenanceConfigurationsOperations operations
4146
:vartype public_maintenance_configurations:
4247
azure.mgmt.maintenance.operations.PublicMaintenanceConfigurationsOperations
@@ -73,12 +78,11 @@ class MaintenanceManagementClient: # pylint: disable=client-accepts-api-version
7378
:vartype updates: azure.mgmt.maintenance.operations.UpdatesOperations
7479
:param credential: Credential needed for the client to connect to Azure. Required.
7580
:type credential: ~azure.core.credentials.TokenCredential
76-
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
77-
subscription. The subscription ID forms part of the URI for every service call. Required.
81+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
7882
:type subscription_id: str
7983
:param base_url: Service URL. Default value is "https://management.azure.com".
8084
:type base_url: str
81-
:keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding
85+
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
8286
this default value may result in unsupported behavior.
8387
:paramtype api_version: str
8488
"""
@@ -93,12 +97,31 @@ def __init__(
9397
self._config = MaintenanceManagementClientConfiguration(
9498
credential=credential, subscription_id=subscription_id, **kwargs
9599
)
96-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
100+
_policies = kwargs.pop("policies", None)
101+
if _policies is None:
102+
_policies = [
103+
policies.RequestIdPolicy(**kwargs),
104+
self._config.headers_policy,
105+
self._config.user_agent_policy,
106+
self._config.proxy_policy,
107+
policies.ContentDecodePolicy(**kwargs),
108+
ARMAutoResourceProviderRegistrationPolicy(),
109+
self._config.redirect_policy,
110+
self._config.retry_policy,
111+
self._config.authentication_policy,
112+
self._config.custom_hook_policy,
113+
self._config.logging_policy,
114+
policies.DistributedTracingPolicy(**kwargs),
115+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
116+
self._config.http_logging_policy,
117+
]
118+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
97119

98120
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
99121
self._serialize = Serializer(client_models)
100122
self._deserialize = Deserializer(client_models)
101123
self._serialize.client_side_validation = False
124+
self.scheduled_event = ScheduledEventOperations(self._client, self._config, self._serialize, self._deserialize)
102125
self.public_maintenance_configurations = PublicMaintenanceConfigurationsOperations(
103126
self._client, self._config, self._serialize, self._deserialize
104127
)
@@ -127,7 +150,7 @@ def __init__(
127150
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
128151
self.updates = UpdatesOperations(self._client, self._config, self._serialize, self._deserialize)
129152

130-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
153+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
131154
"""Runs the network request through the client's chained policies.
132155
133156
>>> from azure.core.rest import HttpRequest
@@ -147,7 +170,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
147170

148171
request_copy = deepcopy(request)
149172
request_copy.url = self._client.format_url(request_copy.url)
150-
return self._client.send_request(request_copy, **kwargs)
173+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
151174

152175
def close(self) -> None:
153176
self._client.close()

0 commit comments

Comments
 (0)