Skip to content

Commit 763b58b

Browse files
author
SDKAuto
committed
CodeGen from PR 31342 in Azure/azure-rest-api-specs
Merge da1c79f299aad0ba327bbb3dd46235eaca63d28e into 4ae412cf228fb0320ced6fd6020435296752bf68
1 parent 84384d3 commit 763b58b

File tree

109 files changed

+6469
-4385
lines changed

Some content is hidden

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

109 files changed

+6469
-4385
lines changed

sdk/storage/azure-mgmt-storagesync/README.md

Lines changed: 2 additions & 5 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 Storage Sync 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
@@ -59,6 +59,3 @@ Code samples for this package can be found at:
5959
If you encounter any bugs or have suggestions, please file an issue in the
6060
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
6161
section of the project.
62-
63-
64-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-storagesync%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "5fc05d0f0b15cbf16de942cadce464b495c66a58",
2+
"commit": "a9a39b7d3805fee40151671f13c7682e76828d6b",
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.26.4",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/storagesync/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.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/storagesync/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.26.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/storagesync/resource-manager/readme.md"
1111
}

sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__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 ._microsoft_storage_sync import MicrosoftStorageSync
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._microsoft_storage_sync import MicrosoftStorageSync # 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
"MicrosoftStorageSync",
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/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,34 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

12-
from azure.core.configuration import Configuration
1311
from azure.core.pipeline import policies
1412
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1513

1614
from ._version import VERSION
1715

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2316
if TYPE_CHECKING:
24-
# pylint: disable=unused-import,ungrouped-imports
2517
from azure.core.credentials import TokenCredential
2618

2719

28-
class MicrosoftStorageSyncConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class MicrosoftStorageSyncConfiguration: # pylint: disable=too-many-instance-attributes
2921
"""Configuration for MicrosoftStorageSync.
3022
3123
Note that all parameters used to create this instance are saved as instance
3224
attributes.
3325
3426
:param credential: Credential needed for the client to connect to Azure. Required.
3527
:type credential: ~azure.core.credentials.TokenCredential
36-
:param subscription_id: The ID of the target subscription. Required.
28+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3729
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this
30+
:keyword api_version: Api Version. Default value is "2022-09-01". Note that overriding this
3931
default value may result in unsupported behavior.
4032
:paramtype api_version: str
4133
"""
4234

4335
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
44-
super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs)
45-
api_version = kwargs.pop("api_version", "2022-06-01") # type: Literal["2022-06-01"]
36+
api_version: str = kwargs.pop("api_version", "2022-09-01")
4637

4738
if credential is None:
4839
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,20 +45,18 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5445
self.api_version = api_version
5546
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5647
kwargs.setdefault("sdk_moniker", "mgmt-storagesync/{}".format(VERSION))
48+
self.polling_interval = kwargs.get("polling_interval", 30)
5749
self._configure(**kwargs)
5850

59-
def _configure(
60-
self, **kwargs # type: Any
61-
):
62-
# type: (...) -> None
51+
def _configure(self, **kwargs: Any) -> None:
6352
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
6453
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
6554
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6655
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6756
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
68-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6957
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
7058
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
59+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
7160
self.authentication_policy = kwargs.get("authentication_policy")
7261
if self.credential and not self.authentication_policy:
7362
self.authentication_policy = ARMChallengeAuthenticationPolicy(

sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_microsoft_storage_sync.py

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
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

15-
from . import models
18+
from . import models as _models
1619
from ._configuration import MicrosoftStorageSyncConfiguration
1720
from ._serialization import Deserializer, Serializer
1821
from .operations import (
@@ -30,14 +33,11 @@
3033
)
3134

3235
if TYPE_CHECKING:
33-
# pylint: disable=unused-import,ungrouped-imports
3436
from azure.core.credentials import TokenCredential
3537

3638

37-
class MicrosoftStorageSync(
38-
MicrosoftStorageSyncOperationsMixin
39-
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
40-
"""Microsoft Storage Sync Service API.
39+
class MicrosoftStorageSync(MicrosoftStorageSyncOperationsMixin): # pylint: disable=too-many-instance-attributes
40+
"""Microsoft Storage Sync Service API. This belongs to Microsoft.StorageSync Resource Provider.
4141
4242
:ivar operations: Operations operations
4343
:vartype operations: azure.mgmt.storagesync.operations.Operations
@@ -63,11 +63,11 @@ class MicrosoftStorageSync(
6363
:vartype operation_status: azure.mgmt.storagesync.operations.OperationStatusOperations
6464
:param credential: Credential needed for the client to connect to Azure. Required.
6565
:type credential: ~azure.core.credentials.TokenCredential
66-
:param subscription_id: The ID of the target subscription. Required.
66+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
6767
:type subscription_id: str
6868
:param base_url: Service URL. Default value is "https://management.azure.com".
6969
:type base_url: str
70-
:keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this
70+
:keyword api_version: Api Version. Default value is "2022-09-01". Note that overriding this
7171
default value may result in unsupported behavior.
7272
:paramtype api_version: str
7373
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -84,9 +84,27 @@ def __init__(
8484
self._config = MicrosoftStorageSyncConfiguration(
8585
credential=credential, subscription_id=subscription_id, **kwargs
8686
)
87-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
88-
89-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
87+
_policies = kwargs.pop("policies", None)
88+
if _policies is None:
89+
_policies = [
90+
policies.RequestIdPolicy(**kwargs),
91+
self._config.headers_policy,
92+
self._config.user_agent_policy,
93+
self._config.proxy_policy,
94+
policies.ContentDecodePolicy(**kwargs),
95+
ARMAutoResourceProviderRegistrationPolicy(),
96+
self._config.redirect_policy,
97+
self._config.retry_policy,
98+
self._config.authentication_policy,
99+
self._config.custom_hook_policy,
100+
self._config.logging_policy,
101+
policies.DistributedTracingPolicy(**kwargs),
102+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
103+
self._config.http_logging_policy,
104+
]
105+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
106+
107+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
90108
self._serialize = Serializer(client_models)
91109
self._deserialize = Deserializer(client_models)
92110
self._serialize.client_side_validation = False
@@ -113,7 +131,7 @@ def __init__(
113131
self._client, self._config, self._serialize, self._deserialize
114132
)
115133

116-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
134+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
117135
"""Runs the network request through the client's chained policies.
118136
119137
>>> from azure.core.rest import HttpRequest
@@ -133,17 +151,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
133151

134152
request_copy = deepcopy(request)
135153
request_copy.url = self._client.format_url(request_copy.url)
136-
return self._client.send_request(request_copy, **kwargs)
154+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
137155

138-
def close(self):
139-
# type: () -> None
156+
def close(self) -> None:
140157
self._client.close()
141158

142-
def __enter__(self):
143-
# type: () -> MicrosoftStorageSync
159+
def __enter__(self) -> Self:
144160
self._client.__enter__()
145161
return self
146162

147-
def __exit__(self, *exc_details):
148-
# type: (Any) -> None
163+
def __exit__(self, *exc_details: Any) -> None:
149164
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)