6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
# --------------------------------------------------------------------------
8
8
9
- from typing import TYPE_CHECKING
9
+ from copy import deepcopy
10
+ from typing import Any , Optional , TYPE_CHECKING
10
11
12
+ from azure .core .rest import HttpRequest , HttpResponse
11
13
from azure .mgmt .core import ARMPipelineClient
12
14
from msrest import Deserializer , Serializer
13
15
16
+ from . import models
17
+ from ._configuration import DataMigrationManagementClientConfiguration
18
+ from .operations import DatabaseMigrationsSqlMiOperations , DatabaseMigrationsSqlVmOperations , FilesOperations , Operations , ProjectsOperations , ResourceSkusOperations , ServiceTasksOperations , ServicesOperations , SqlMigrationServicesOperations , TasksOperations , UsagesOperations
19
+
14
20
if TYPE_CHECKING :
15
21
# pylint: disable=unused-import,ungrouped-imports
16
- from typing import Any , Optional
17
-
18
22
from azure .core .credentials import TokenCredential
19
- from azure .core .pipeline .transport import HttpRequest , HttpResponse
20
-
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
30
- from . import models
31
-
32
23
33
- class DataMigrationManagementClient ( object ) :
24
+ class DataMigrationManagementClient :
34
25
"""Data Migration Client.
35
26
27
+ :ivar database_migrations_sql_mi: DatabaseMigrationsSqlMiOperations operations
28
+ :vartype database_migrations_sql_mi:
29
+ azure.mgmt.datamigration.operations.DatabaseMigrationsSqlMiOperations
30
+ :ivar database_migrations_sql_vm: DatabaseMigrationsSqlVmOperations operations
31
+ :vartype database_migrations_sql_vm:
32
+ azure.mgmt.datamigration.operations.DatabaseMigrationsSqlVmOperations
33
+ :ivar operations: Operations operations
34
+ :vartype operations: azure.mgmt.datamigration.operations.Operations
35
+ :ivar sql_migration_services: SqlMigrationServicesOperations operations
36
+ :vartype sql_migration_services:
37
+ azure.mgmt.datamigration.operations.SqlMigrationServicesOperations
36
38
:ivar resource_skus: ResourceSkusOperations operations
37
39
:vartype resource_skus: azure.mgmt.datamigration.operations.ResourceSkusOperations
38
40
:ivar services: ServicesOperations operations
@@ -45,70 +47,70 @@ class DataMigrationManagementClient(object):
45
47
:vartype projects: azure.mgmt.datamigration.operations.ProjectsOperations
46
48
:ivar usages: UsagesOperations operations
47
49
:vartype usages: azure.mgmt.datamigration.operations.UsagesOperations
48
- :ivar operations: Operations operations
49
- :vartype operations: azure.mgmt.datamigration.operations.Operations
50
50
:ivar files: FilesOperations operations
51
51
:vartype files: azure.mgmt.datamigration.operations.FilesOperations
52
52
:param credential: Credential needed for the client to connect to Azure.
53
53
:type credential: ~azure.core.credentials.TokenCredential
54
- :param subscription_id: Identifier of the subscription.
54
+ :param subscription_id: Subscription ID that identifies an Azure subscription.
55
55
: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.
56
+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
57
+ :type base_url: str
58
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
59
+ Retry-After header is present.
58
60
"""
59
61
60
62
def __init__ (
61
63
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 )
64
+ credential : "TokenCredential" ,
65
+ subscription_id : str ,
66
+ base_url : str = "https://management.azure.com" ,
67
+ ** kwargs : Any
68
+ ) -> None :
69
+ self ._config = DataMigrationManagementClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
71
70
self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
72
71
73
72
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
74
73
self ._serialize = Serializer (client_models )
75
- self ._serialize .client_side_validation = False
76
74
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
75
+ self ._serialize .client_side_validation = False
76
+ self .database_migrations_sql_mi = DatabaseMigrationsSqlMiOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
77
+ self .database_migrations_sql_vm = DatabaseMigrationsSqlVmOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
78
+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
79
+ self .sql_migration_services = SqlMigrationServicesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
80
+ self .resource_skus = ResourceSkusOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
81
+ self .services = ServicesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
82
+ self .tasks = TasksOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
83
+ self .service_tasks = ServiceTasksOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
84
+ self .projects = ProjectsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
85
+ self .usages = UsagesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
86
+ self .files = FilesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
87
+
88
+
89
+ def _send_request (
90
+ self ,
91
+ request , # type: HttpRequest
92
+ ** kwargs : Any
93
+ ) -> HttpResponse :
97
94
"""Runs the network request through the client's chained policies.
98
95
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.
96
+ >>> from azure.core.rest import HttpRequest
97
+ >>> request = HttpRequest("GET", "https://www.example.org/")
98
+ <HttpRequest [GET], url: 'https://www.example.org/'>
99
+ >>> response = client._send_request(request)
100
+ <HttpResponse: 200 OK>
101
+
102
+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
103
+
104
+ :param request: The network request you want to make. Required.
105
+ :type request: ~azure.core.rest.HttpRequest
106
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
102
107
:return: The response of your network call. Does not do error handling on your response.
103
- :rtype: ~azure.core.pipeline.transport .HttpResponse
108
+ :rtype: ~azure.core.rest .HttpResponse
104
109
"""
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
110
+
111
+ request_copy = deepcopy (request )
112
+ request_copy .url = self ._client .format_url (request_copy .url )
113
+ return self ._client .send_request (request_copy , ** kwargs )
112
114
113
115
def close (self ):
114
116
# type: () -> None
0 commit comments