Skip to content

Commit 75846aa

Browse files
author
SDKAuto
committed
CodeGen from PR 19389 in Azure/azure-rest-api-specs
Merge a3e44e3b559225047402a24b10fba1bc5a7d9737 into 4124b7c2773a714303299f0cfd742b0d26d3bb5d
1 parent 6d22152 commit 75846aa

Some content is hidden

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

42 files changed

+17831
-18337
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.4.5",
2+
"autorest": "3.7.2",
33
"use": [
4-
"@autorest/python@5.8.4",
5-
"@autorest/[email protected].2"
4+
"@autorest/python@5.13.0",
5+
"@autorest/[email protected].3"
66
],
7-
"commit": "850425353115aa23d469f12f44847ff9e8326294",
7+
"commit": "e88630e86bd039beb9ed632350e8802c70f68312",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/datamigration/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.8.4 --use=@autorest/[email protected].2 --version=3.4.5",
9+
"autorest_command": "autorest specification/datamigration/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/[email protected].3 --version=3.7.2",
1010
"readme": "specification/datamigration/resource-manager/readme.md"
1111
}

sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/__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__ = ['DataMigrationManagementClient']
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/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_configuration.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,51 @@
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

24-
class DataMigrationManagementClientConfiguration(Configuration):
22+
class DataMigrationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2523
"""Configuration for DataMigrationManagementClient.
2624
2725
Note that all parameters used to create this instance are saved as instance
2826
attributes.
2927
3028
:param credential: Credential needed for the client to connect to Azure.
3129
:type credential: ~azure.core.credentials.TokenCredential
32-
:param subscription_id: Identifier of the subscription.
30+
:param subscription_id: Subscription ID that identifies an Azure subscription.
3331
:type subscription_id: str
32+
:keyword api_version: Api Version. Default value is "2022-03-30-preview". Note that overriding
33+
this default value may result in unsupported behavior.
34+
:paramtype api_version: str
3435
"""
3536

3637
def __init__(
3738
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
39+
credential: "TokenCredential",
40+
subscription_id: str,
41+
**kwargs: Any
42+
) -> None:
43+
super(DataMigrationManagementClientConfiguration, self).__init__(**kwargs)
44+
api_version = kwargs.pop('api_version', "2022-03-30-preview") # type: str
45+
4346
if credential is None:
4447
raise ValueError("Parameter 'credential' must not be None.")
4548
if subscription_id is None:
4649
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(DataMigrationManagementClientConfiguration, self).__init__(**kwargs)
4850

4951
self.credential = credential
5052
self.subscription_id = subscription_id
51-
self.api_version = "2021-06-30"
53+
self.api_version = api_version
5254
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
5355
kwargs.setdefault('sdk_moniker', 'mgmt-datamigration/{}'.format(VERSION))
5456
self._configure(**kwargs)
@@ -68,4 +70,4 @@ def _configure(
6870
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6971
self.authentication_policy = kwargs.get('authentication_policy')
7072
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
73+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_data_migration_management_client.py

Lines changed: 74 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,39 @@
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, TYPE_CHECKING
1011

11-
from azure.mgmt.core import ARMPipelineClient
1212
from msrest import Deserializer, Serializer
1313

14-
if TYPE_CHECKING:
15-
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
18-
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.mgmt.core import ARMPipelineClient
2016

21-
from ._configuration import DataMigrationManagementClientConfiguration
22-
from .operations import ResourceSkusOperations
23-
from .operations import ServicesOperations
24-
from .operations import TasksOperations
25-
from .operations import ServiceTasksOperations
26-
from .operations import ProjectsOperations
27-
from .operations import UsagesOperations
28-
from .operations import Operations
29-
from .operations import FilesOperations
3017
from . import models
18+
from ._configuration import DataMigrationManagementClientConfiguration
19+
from .operations import DatabaseMigrationsSqlDbOperations, DatabaseMigrationsSqlMiOperations, DatabaseMigrationsSqlVmOperations, FilesOperations, Operations, ProjectsOperations, ResourceSkusOperations, ServiceTasksOperations, ServicesOperations, SqlMigrationServicesOperations, TasksOperations, UsagesOperations
3120

21+
if TYPE_CHECKING:
22+
# pylint: disable=unused-import,ungrouped-imports
23+
from azure.core.credentials import TokenCredential
3224

33-
class DataMigrationManagementClient(object):
25+
class DataMigrationManagementClient: # pylint: disable=too-many-instance-attributes
3426
"""Data Migration Client.
3527
28+
:ivar database_migrations_sql_db: DatabaseMigrationsSqlDbOperations operations
29+
:vartype database_migrations_sql_db:
30+
azure.mgmt.datamigration.operations.DatabaseMigrationsSqlDbOperations
31+
:ivar database_migrations_sql_mi: DatabaseMigrationsSqlMiOperations operations
32+
:vartype database_migrations_sql_mi:
33+
azure.mgmt.datamigration.operations.DatabaseMigrationsSqlMiOperations
34+
:ivar database_migrations_sql_vm: DatabaseMigrationsSqlVmOperations operations
35+
:vartype database_migrations_sql_vm:
36+
azure.mgmt.datamigration.operations.DatabaseMigrationsSqlVmOperations
37+
:ivar operations: Operations operations
38+
:vartype operations: azure.mgmt.datamigration.operations.Operations
39+
:ivar sql_migration_services: SqlMigrationServicesOperations operations
40+
:vartype sql_migration_services:
41+
azure.mgmt.datamigration.operations.SqlMigrationServicesOperations
3642
:ivar resource_skus: ResourceSkusOperations operations
3743
:vartype resource_skus: azure.mgmt.datamigration.operations.ResourceSkusOperations
3844
:ivar services: ServicesOperations operations
@@ -45,70 +51,74 @@ class DataMigrationManagementClient(object):
4551
:vartype projects: azure.mgmt.datamigration.operations.ProjectsOperations
4652
:ivar usages: UsagesOperations operations
4753
:vartype usages: azure.mgmt.datamigration.operations.UsagesOperations
48-
:ivar operations: Operations operations
49-
:vartype operations: azure.mgmt.datamigration.operations.Operations
5054
:ivar files: FilesOperations operations
5155
:vartype files: azure.mgmt.datamigration.operations.FilesOperations
5256
:param credential: Credential needed for the client to connect to Azure.
5357
:type credential: ~azure.core.credentials.TokenCredential
54-
:param subscription_id: Identifier of the subscription.
58+
:param subscription_id: Subscription ID that identifies an Azure subscription.
5559
:type subscription_id: str
56-
:param str base_url: Service URL
57-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
60+
:param base_url: Service URL. Default value is "https://management.azure.com".
61+
:type base_url: str
62+
:keyword api_version: Api Version. Default value is "2022-03-30-preview". Note that overriding
63+
this default value may result in unsupported behavior.
64+
:paramtype api_version: str
65+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
66+
Retry-After header is present.
5867
"""
5968

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

7379
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
7480
self._serialize = Serializer(client_models)
75-
self._serialize.client_side_validation = False
7681
self._deserialize = Deserializer(client_models)
77-
78-
self.resource_skus = ResourceSkusOperations(
79-
self._client, self._config, self._serialize, self._deserialize)
80-
self.services = ServicesOperations(
81-
self._client, self._config, self._serialize, self._deserialize)
82-
self.tasks = TasksOperations(
83-
self._client, self._config, self._serialize, self._deserialize)
84-
self.service_tasks = ServiceTasksOperations(
85-
self._client, self._config, self._serialize, self._deserialize)
86-
self.projects = ProjectsOperations(
87-
self._client, self._config, self._serialize, self._deserialize)
88-
self.usages = UsagesOperations(
89-
self._client, self._config, self._serialize, self._deserialize)
90-
self.operations = Operations(
91-
self._client, self._config, self._serialize, self._deserialize)
92-
self.files = FilesOperations(
93-
self._client, self._config, self._serialize, self._deserialize)
94-
95-
def _send_request(self, http_request, **kwargs):
96-
# type: (HttpRequest, Any) -> HttpResponse
82+
self._serialize.client_side_validation = False
83+
self.database_migrations_sql_db = DatabaseMigrationsSqlDbOperations(self._client, self._config, self._serialize, self._deserialize)
84+
self.database_migrations_sql_mi = DatabaseMigrationsSqlMiOperations(self._client, self._config, self._serialize, self._deserialize)
85+
self.database_migrations_sql_vm = DatabaseMigrationsSqlVmOperations(self._client, self._config, self._serialize, self._deserialize)
86+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
87+
self.sql_migration_services = SqlMigrationServicesOperations(self._client, self._config, self._serialize, self._deserialize)
88+
self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize)
89+
self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize)
90+
self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize)
91+
self.service_tasks = ServiceTasksOperations(self._client, self._config, self._serialize, self._deserialize)
92+
self.projects = ProjectsOperations(self._client, self._config, self._serialize, self._deserialize)
93+
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
94+
self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize)
95+
96+
97+
def _send_request(
98+
self,
99+
request: HttpRequest,
100+
**kwargs: Any
101+
) -> HttpResponse:
97102
"""Runs the network request through the client's chained policies.
98103
99-
:param http_request: The network request you want to make. Required.
100-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
101-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
104+
>>> from azure.core.rest import HttpRequest
105+
>>> request = HttpRequest("GET", "https://www.example.org/")
106+
<HttpRequest [GET], url: 'https://www.example.org/'>
107+
>>> response = client._send_request(request)
108+
<HttpResponse: 200 OK>
109+
110+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
111+
112+
:param request: The network request you want to make. Required.
113+
:type request: ~azure.core.rest.HttpRequest
114+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
102115
:return: The response of your network call. Does not do error handling on your response.
103-
:rtype: ~azure.core.pipeline.transport.HttpResponse
116+
:rtype: ~azure.core.rest.HttpResponse
104117
"""
105-
path_format_arguments = {
106-
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
107-
}
108-
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
109-
stream = kwargs.pop("stream", True)
110-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
111-
return pipeline_response.http_response
118+
119+
request_copy = deepcopy(request)
120+
request_copy.url = self._client.format_url(request_copy.url)
121+
return self._client.send_request(request_copy, **kwargs)
112122

113123
def close(self):
114124
# type: () -> None

0 commit comments

Comments
 (0)