Skip to content

Commit 129fe0a

Browse files
author
SDKAuto
committed
CodeGen from PR 17159 in Azure/azure-rest-api-specs
Merge a917c08290679943c514e3ff197c468c1f652d05 into 31e3d74
1 parent 183699b commit 129fe0a

40 files changed

+6223
-6609
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"autorest": "3.0.6369",
3-
"use": "@autorest/[email protected]",
4-
"commit": "18ed65c7581a1142c0015451e4d61ef0a3797268",
2+
"autorest": "3.7.2",
3+
"use": [
4+
"@autorest/[email protected]",
5+
"@autorest/[email protected]"
6+
],
7+
"commit": "7f2d20c3ec2543bc4fca9f82f4408289f3178bee",
58
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
6-
"autorest_command": "autorest specification/storagesync/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.2 --version=3.0.6369",
9+
"autorest_command": "autorest specification/storagesync/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/[email protected] --version=3.7.2",
710
"readme": "specification/storagesync/resource-manager/readme.md"
811
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
__version__ = VERSION
1313
__all__ = ['MicrosoftStorageSync']
1414

15-
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
18-
except ImportError:
19-
pass
15+
# `._patch.py` is used for handwritten extensions to the generated code
16+
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17+
from ._patch import patch_sdk
18+
patch_sdk()

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

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

9-
from typing import TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1414

1515
from ._version import VERSION
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

@@ -35,16 +33,15 @@ class MicrosoftStorageSyncConfiguration(Configuration):
3533

3634
def __init__(
3735
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
36+
credential: "TokenCredential",
37+
subscription_id: str,
38+
**kwargs: Any
39+
) -> None:
40+
super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs)
4341
if credential is None:
4442
raise ValueError("Parameter 'credential' must not be None.")
4543
if subscription_id is None:
4644
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
@@ -68,4 +65,4 @@ def _configure(
6865
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6966
self.authentication_policy = kwargs.get('authentication_policy')
7067
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
68+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_metadata.json

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"name": "MicrosoftStorageSync",
66
"filename": "_microsoft_storage_sync",
77
"description": "Microsoft Storage Sync Service API.",
8-
"base_url": "\u0027https://management.azure.com\u0027",
9-
"custom_base_url": null,
8+
"host_value": "\"https://management.azure.com\"",
9+
"parameterized_host_template": null,
1010
"azure_arm": true,
1111
"has_lro_operations": true,
1212
"client_side_validation": false,
13-
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftStorageSyncConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
14-
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftStorageSyncConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
13+
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftStorageSyncConfiguration\"], \"._operations_mixin\": [\"MicrosoftStorageSyncOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
14+
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftStorageSyncConfiguration\"], \"._operations_mixin\": [\"MicrosoftStorageSyncOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
1515
},
1616
"global_parameters": {
1717
"sync": {
@@ -54,7 +54,7 @@
5454
"required": false
5555
},
5656
"base_url": {
57-
"signature": "base_url=None, # type: Optional[str]",
57+
"signature": "base_url=\"https://management.azure.com\", # type: str",
5858
"description": "Service URL",
5959
"docstring_type": "str",
6060
"required": false
@@ -74,7 +74,7 @@
7474
"required": false
7575
},
7676
"base_url": {
77-
"signature": "base_url: Optional[str] = None,",
77+
"signature": "base_url: str = \"https://management.azure.com\",",
7878
"description": "Service URL",
7979
"docstring_type": "str",
8080
"required": false
@@ -91,11 +91,10 @@
9191
"config": {
9292
"credential": true,
9393
"credential_scopes": ["https://management.azure.com/.default"],
94-
"credential_default_policy_type": "BearerTokenCredentialPolicy",
95-
"credential_default_policy_type_has_async_version": true,
96-
"credential_key_header_name": null,
97-
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
98-
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
94+
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
95+
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
96+
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
97+
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
9998
},
10099
"operation_groups": {
101100
"operations": "Operations",
@@ -110,9 +109,21 @@
110109
"operation_status": "OperationStatusOperations"
111110
},
112111
"operation_mixins": {
113-
"sync_imports": "None",
114-
"async_imports": "None",
112+
"sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}",
113+
"async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}",
115114
"operations": {
115+
"location_operation_status" : {
116+
"sync": {
117+
"signature": "def location_operation_status(\n self,\n location_name, # type: str\n operation_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.LocationOperationStatus\"\n",
118+
"doc": "\"\"\"Get Operation status.\n\n:param location_name: The desired region to obtain information from.\n:type location_name: str\n:param operation_id: operation Id.\n:type operation_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: LocationOperationStatus, or the result of cls(response)\n:rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\""
119+
},
120+
"async": {
121+
"coroutine": true,
122+
"signature": "async def location_operation_status(\n self,\n location_name: str,\n operation_id: str,\n **kwargs: Any\n) -\u003e \"_models.LocationOperationStatus\":\n",
123+
"doc": "\"\"\"Get Operation status.\n\n:param location_name: The desired region to obtain information from.\n:type location_name: str\n:param operation_id: operation Id.\n:type operation_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: LocationOperationStatus, or the result of cls(response)\n:rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\""
124+
},
125+
"call": "location_name, operation_id"
126+
}
116127
}
117128
}
118129
}

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

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

9-
from typing import TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, Optional, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
1214
from msrest import Deserializer, Serializer
1315

16+
from . import models
17+
from ._configuration import MicrosoftStorageSyncConfiguration
18+
from .operations import CloudEndpointsOperations, MicrosoftStorageSyncOperationsMixin, OperationStatusOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RegisteredServersOperations, ServerEndpointsOperations, StorageSyncServicesOperations, SyncGroupsOperations, WorkflowsOperations
19+
1420
if TYPE_CHECKING:
1521
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1822
from azure.core.credentials import TokenCredential
1923

20-
from ._configuration import MicrosoftStorageSyncConfiguration
21-
from .operations import Operations
22-
from .operations import StorageSyncServicesOperations
23-
from .operations import PrivateLinkResourcesOperations
24-
from .operations import PrivateEndpointConnectionsOperations
25-
from .operations import SyncGroupsOperations
26-
from .operations import CloudEndpointsOperations
27-
from .operations import ServerEndpointsOperations
28-
from .operations import RegisteredServersOperations
29-
from .operations import WorkflowsOperations
30-
from .operations import OperationStatusOperations
31-
from . import models
32-
33-
34-
class MicrosoftStorageSync(object):
24+
class MicrosoftStorageSync(MicrosoftStorageSyncOperationsMixin):
3525
"""Microsoft Storage Sync Service API.
3626
3727
:ivar operations: Operations operations
3828
:vartype operations: azure.mgmt.storagesync.operations.Operations
3929
:ivar storage_sync_services: StorageSyncServicesOperations operations
4030
:vartype storage_sync_services: azure.mgmt.storagesync.operations.StorageSyncServicesOperations
4131
:ivar private_link_resources: PrivateLinkResourcesOperations operations
42-
:vartype private_link_resources: azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations
32+
:vartype private_link_resources:
33+
azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations
4334
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
44-
:vartype private_endpoint_connections: azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations
35+
:vartype private_endpoint_connections:
36+
azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations
4537
:ivar sync_groups: SyncGroupsOperations operations
4638
:vartype sync_groups: azure.mgmt.storagesync.operations.SyncGroupsOperations
4739
:ivar cloud_endpoints: CloudEndpointsOperations operations
@@ -58,48 +50,63 @@ class MicrosoftStorageSync(object):
5850
:type credential: ~azure.core.credentials.TokenCredential
5951
:param subscription_id: The ID of the target subscription.
6052
:type subscription_id: str
61-
:param str base_url: Service URL
62-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
53+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
54+
:type base_url: str
55+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
56+
Retry-After header is present.
6357
"""
6458

6559
def __init__(
6660
self,
67-
credential, # type: "TokenCredential"
68-
subscription_id, # type: str
69-
base_url=None, # type: Optional[str]
70-
**kwargs # type: Any
71-
):
72-
# type: (...) -> None
73-
if not base_url:
74-
base_url = 'https://management.azure.com'
75-
self._config = MicrosoftStorageSyncConfiguration(credential, subscription_id, **kwargs)
61+
credential: "TokenCredential",
62+
subscription_id: str,
63+
base_url: str = "https://management.azure.com",
64+
**kwargs: Any
65+
) -> None:
66+
self._config = MicrosoftStorageSyncConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
7667
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7768

7869
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
7970
self._serialize = Serializer(client_models)
80-
self._serialize.client_side_validation = False
8171
self._deserialize = Deserializer(client_models)
72+
self._serialize.client_side_validation = False
73+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
74+
self.storage_sync_services = StorageSyncServicesOperations(self._client, self._config, self._serialize, self._deserialize)
75+
self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize)
76+
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
77+
self.sync_groups = SyncGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
78+
self.cloud_endpoints = CloudEndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
79+
self.server_endpoints = ServerEndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
80+
self.registered_servers = RegisteredServersOperations(self._client, self._config, self._serialize, self._deserialize)
81+
self.workflows = WorkflowsOperations(self._client, self._config, self._serialize, self._deserialize)
82+
self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize)
83+
84+
85+
def _send_request(
86+
self,
87+
request, # type: HttpRequest
88+
**kwargs: Any
89+
) -> HttpResponse:
90+
"""Runs the network request through the client's chained policies.
91+
92+
>>> from azure.core.rest import HttpRequest
93+
>>> request = HttpRequest("GET", "https://www.example.org/")
94+
<HttpRequest [GET], url: 'https://www.example.org/'>
95+
>>> response = client._send_request(request)
96+
<HttpResponse: 200 OK>
97+
98+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
99+
100+
:param request: The network request you want to make. Required.
101+
:type request: ~azure.core.rest.HttpRequest
102+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
103+
:return: The response of your network call. Does not do error handling on your response.
104+
:rtype: ~azure.core.rest.HttpResponse
105+
"""
82106

83-
self.operations = Operations(
84-
self._client, self._config, self._serialize, self._deserialize)
85-
self.storage_sync_services = StorageSyncServicesOperations(
86-
self._client, self._config, self._serialize, self._deserialize)
87-
self.private_link_resources = PrivateLinkResourcesOperations(
88-
self._client, self._config, self._serialize, self._deserialize)
89-
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
90-
self._client, self._config, self._serialize, self._deserialize)
91-
self.sync_groups = SyncGroupsOperations(
92-
self._client, self._config, self._serialize, self._deserialize)
93-
self.cloud_endpoints = CloudEndpointsOperations(
94-
self._client, self._config, self._serialize, self._deserialize)
95-
self.server_endpoints = ServerEndpointsOperations(
96-
self._client, self._config, self._serialize, self._deserialize)
97-
self.registered_servers = RegisteredServersOperations(
98-
self._client, self._config, self._serialize, self._deserialize)
99-
self.workflows = WorkflowsOperations(
100-
self._client, self._config, self._serialize, self._deserialize)
101-
self.operation_status = OperationStatusOperations(
102-
self._client, self._config, self._serialize, self._deserialize)
107+
request_copy = deepcopy(request)
108+
request_copy.url = self._client.format_url(request_copy.url)
109+
return self._client.send_request(request_copy, **kwargs)
103110

104111
def close(self):
105112
# type: () -> None

0 commit comments

Comments
 (0)