Skip to content

Commit 1e44d01

Browse files
author
SDKAuto
committed
CodeGen from PR 31001 in Azure/azure-rest-api-specs
Merge 91c7ab62a4883214947ef09bf9fea29766b2659b into 9ce76c4f113368361dac4de5d0a71eb058602756
1 parent 62ddf8f commit 1e44d01

File tree

160 files changed

+14528
-5946
lines changed

Some content is hidden

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

160 files changed

+14528
-5946
lines changed

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

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 Data Migration 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_
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/)
17-
Code samples for this package can be found at [Data Migration](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://aka.ms/azsdk/python/mgmt/samples)
15+
- Python 3.8+ 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-datamigration
22+
pip install azure-identity
23+
```
24+
25+
### Authentication
26+
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of 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.datamigration import DataMigrationManagementClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = DataMigrationManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Data Migration](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
2258

2359
If you encounter any bugs or have suggestions, please file an issue in the
2460
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
2561
section of the project.
26-
27-
28-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-datamigration%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "3ce1e043e2d0e57016437a3870f40e33da8a6397",
2+
"commit": "2df8525ab545127262d700400c7db781ba50eb17",
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.7",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.19.0",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/datamigration/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.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/datamigration/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.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/datamigration/resource-manager/readme.md"
1111
}

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,19 @@
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:
2417
# pylint: disable=unused-import,ungrouped-imports
2518
from azure.core.credentials import TokenCredential
2619

2720

28-
class DataMigrationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
21+
class DataMigrationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2922
"""Configuration for DataMigrationManagementClient.
3023
3124
Note that all parameters used to create this instance are saved as instance
@@ -35,14 +28,13 @@ class DataMigrationManagementClientConfiguration(Configuration): # pylint: disa
3528
:type credential: ~azure.core.credentials.TokenCredential
3629
:param subscription_id: Subscription ID that identifies an Azure subscription. Required.
3730
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2022-03-30-preview". Note that overriding
31+
:keyword api_version: Api Version. Default value is "2023-07-15-preview". Note that overriding
3932
this default value may result in unsupported behavior.
4033
:paramtype api_version: str
4134
"""
4235

4336
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
44-
super(DataMigrationManagementClientConfiguration, self).__init__(**kwargs)
45-
api_version: Literal["2022-03-30-preview"] = kwargs.pop("api_version", "2022-03-30-preview")
37+
api_version: str = kwargs.pop("api_version", "2023-07-15-preview")
4638

4739
if credential is None:
4840
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5446
self.api_version = api_version
5547
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5648
kwargs.setdefault("sdk_moniker", "mgmt-datamigration/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
5750
self._configure(**kwargs)
5851

5952
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
6255
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6356
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6457
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
65-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6658
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6759
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6861
self.authentication_policy = kwargs.get("authentication_policy")
6962
if self.credential and not self.authentication_policy:
7063
self.authentication_policy = ARMChallengeAuthenticationPolicy(

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

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

1518
from . import models as _models
1619
from ._configuration import DataMigrationManagementClientConfiguration
1720
from ._serialization import Deserializer, Serializer
1821
from .operations import (
22+
DatabaseMigrationsMongoToCosmosDbRUMongoOperations,
23+
DatabaseMigrationsMongoToCosmosDbvCoreMongoOperations,
1924
DatabaseMigrationsSqlDbOperations,
2025
DatabaseMigrationsSqlMiOperations,
2126
DatabaseMigrationsSqlVmOperations,
2227
FilesOperations,
28+
MigrationServicesOperations,
2329
Operations,
2430
ProjectsOperations,
2531
ResourceSkusOperations,
@@ -38,6 +44,14 @@
3844
class DataMigrationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3945
"""Data Migration Client.
4046
47+
:ivar database_migrations_mongo_to_cosmos_db_ru_mongo:
48+
DatabaseMigrationsMongoToCosmosDbRUMongoOperations operations
49+
:vartype database_migrations_mongo_to_cosmos_db_ru_mongo:
50+
azure.mgmt.datamigration.operations.DatabaseMigrationsMongoToCosmosDbRUMongoOperations
51+
:ivar database_migrations_mongo_to_cosmos_dbv_core_mongo:
52+
DatabaseMigrationsMongoToCosmosDbvCoreMongoOperations operations
53+
:vartype database_migrations_mongo_to_cosmos_dbv_core_mongo:
54+
azure.mgmt.datamigration.operations.DatabaseMigrationsMongoToCosmosDbvCoreMongoOperations
4155
:ivar database_migrations_sql_db: DatabaseMigrationsSqlDbOperations operations
4256
:vartype database_migrations_sql_db:
4357
azure.mgmt.datamigration.operations.DatabaseMigrationsSqlDbOperations
@@ -49,6 +63,8 @@ class DataMigrationManagementClient: # pylint: disable=client-accepts-api-versi
4963
azure.mgmt.datamigration.operations.DatabaseMigrationsSqlVmOperations
5064
:ivar operations: Operations operations
5165
:vartype operations: azure.mgmt.datamigration.operations.Operations
66+
:ivar migration_services: MigrationServicesOperations operations
67+
:vartype migration_services: azure.mgmt.datamigration.operations.MigrationServicesOperations
5268
:ivar sql_migration_services: SqlMigrationServicesOperations operations
5369
:vartype sql_migration_services:
5470
azure.mgmt.datamigration.operations.SqlMigrationServicesOperations
@@ -72,7 +88,7 @@ class DataMigrationManagementClient: # pylint: disable=client-accepts-api-versi
7288
:type subscription_id: str
7389
:param base_url: Service URL. Default value is "https://management.azure.com".
7490
:type base_url: str
75-
:keyword api_version: Api Version. Default value is "2022-03-30-preview". Note that overriding
91+
:keyword api_version: Api Version. Default value is "2023-07-15-preview". Note that overriding
7692
this default value may result in unsupported behavior.
7793
:paramtype api_version: str
7894
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -89,12 +105,36 @@ def __init__(
89105
self._config = DataMigrationManagementClientConfiguration(
90106
credential=credential, subscription_id=subscription_id, **kwargs
91107
)
92-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
108+
_policies = kwargs.pop("policies", None)
109+
if _policies is None:
110+
_policies = [
111+
policies.RequestIdPolicy(**kwargs),
112+
self._config.headers_policy,
113+
self._config.user_agent_policy,
114+
self._config.proxy_policy,
115+
policies.ContentDecodePolicy(**kwargs),
116+
ARMAutoResourceProviderRegistrationPolicy(),
117+
self._config.redirect_policy,
118+
self._config.retry_policy,
119+
self._config.authentication_policy,
120+
self._config.custom_hook_policy,
121+
self._config.logging_policy,
122+
policies.DistributedTracingPolicy(**kwargs),
123+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
124+
self._config.http_logging_policy,
125+
]
126+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
93127

94128
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
95129
self._serialize = Serializer(client_models)
96130
self._deserialize = Deserializer(client_models)
97131
self._serialize.client_side_validation = False
132+
self.database_migrations_mongo_to_cosmos_db_ru_mongo = DatabaseMigrationsMongoToCosmosDbRUMongoOperations(
133+
self._client, self._config, self._serialize, self._deserialize
134+
)
135+
self.database_migrations_mongo_to_cosmos_dbv_core_mongo = DatabaseMigrationsMongoToCosmosDbvCoreMongoOperations(
136+
self._client, self._config, self._serialize, self._deserialize
137+
)
98138
self.database_migrations_sql_db = DatabaseMigrationsSqlDbOperations(
99139
self._client, self._config, self._serialize, self._deserialize
100140
)
@@ -105,6 +145,9 @@ def __init__(
105145
self._client, self._config, self._serialize, self._deserialize
106146
)
107147
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
148+
self.migration_services = MigrationServicesOperations(
149+
self._client, self._config, self._serialize, self._deserialize
150+
)
108151
self.sql_migration_services = SqlMigrationServicesOperations(
109152
self._client, self._config, self._serialize, self._deserialize
110153
)
@@ -116,7 +159,7 @@ def __init__(
116159
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
117160
self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize)
118161

119-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
162+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
120163
"""Runs the network request through the client's chained policies.
121164
122165
>>> from azure.core.rest import HttpRequest
@@ -136,14 +179,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
136179

137180
request_copy = deepcopy(request)
138181
request_copy.url = self._client.format_url(request_copy.url)
139-
return self._client.send_request(request_copy, **kwargs)
182+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
140183

141184
def close(self) -> None:
142185
self._client.close()
143186

144-
def __enter__(self) -> "DataMigrationManagementClient":
187+
def __enter__(self) -> Self:
145188
self._client.__enter__()
146189
return self
147190

148-
def __exit__(self, *exc_details) -> None:
191+
def __exit__(self, *exc_details: Any) -> None:
149192
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)