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 AzureArcVMwareManagementServiceAPIConfiguration
18
+ from .operations import ClustersOperations , DatastoresOperations , GuestAgentsOperations , HostsOperations , HybridIdentityMetadataOperations , InventoryItemsOperations , MachineExtensionsOperations , Operations , ResourcePoolsOperations , VCentersOperations , VirtualMachineTemplatesOperations , VirtualMachinesOperations , VirtualNetworksOperations
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 AzureArcVMwareManagementServiceAPIConfiguration
22
- from .operations import Operations
23
- from .operations import ResourcePoolsOperations
24
- from .operations import ClustersOperations
25
- from .operations import HostsOperations
26
- from .operations import DatastoresOperations
27
- from .operations import VCentersOperations
28
- from .operations import VirtualMachinesOperations
29
- from .operations import VirtualMachineTemplatesOperations
30
- from .operations import VirtualNetworksOperations
31
- from .operations import InventoryItemsOperations
32
- from .operations import HybridIdentityMetadataOperations
33
- from .operations import MachineExtensionsOperations
34
- from .operations import GuestAgentsOperations
35
- from . import models
36
-
37
23
38
- class AzureArcVMwareManagementServiceAPI ( object ) :
24
+ class AzureArcVMwareManagementServiceAPI :
39
25
"""Self service experience for VMware.
40
26
41
27
:ivar operations: Operations operations
@@ -53,13 +39,15 @@ class AzureArcVMwareManagementServiceAPI(object):
53
39
:ivar virtual_machines: VirtualMachinesOperations operations
54
40
:vartype virtual_machines: azure.mgmt.connectedvmware.operations.VirtualMachinesOperations
55
41
:ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations
56
- :vartype virtual_machine_templates: azure.mgmt.connectedvmware.operations.VirtualMachineTemplatesOperations
42
+ :vartype virtual_machine_templates:
43
+ azure.mgmt.connectedvmware.operations.VirtualMachineTemplatesOperations
57
44
:ivar virtual_networks: VirtualNetworksOperations operations
58
45
:vartype virtual_networks: azure.mgmt.connectedvmware.operations.VirtualNetworksOperations
59
46
:ivar inventory_items: InventoryItemsOperations operations
60
47
:vartype inventory_items: azure.mgmt.connectedvmware.operations.InventoryItemsOperations
61
48
:ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations
62
- :vartype hybrid_identity_metadata: azure.mgmt.connectedvmware.operations.HybridIdentityMetadataOperations
49
+ :vartype hybrid_identity_metadata:
50
+ azure.mgmt.connectedvmware.operations.HybridIdentityMetadataOperations
63
51
:ivar machine_extensions: MachineExtensionsOperations operations
64
52
:vartype machine_extensions: azure.mgmt.connectedvmware.operations.MachineExtensionsOperations
65
53
:ivar guest_agents: GuestAgentsOperations operations
@@ -68,72 +56,66 @@ class AzureArcVMwareManagementServiceAPI(object):
68
56
:type credential: ~azure.core.credentials.TokenCredential
69
57
:param subscription_id: The Subscription ID.
70
58
:type subscription_id: str
71
- :param str base_url: Service URL
72
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
59
+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
60
+ :type base_url: str
61
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
62
+ Retry-After header is present.
73
63
"""
74
64
75
65
def __init__ (
76
66
self ,
77
- credential , # type: "TokenCredential"
78
- subscription_id , # type: str
79
- base_url = None , # type: Optional[str]
80
- ** kwargs # type: Any
81
- ):
82
- # type: (...) -> None
83
- if not base_url :
84
- base_url = 'https://management.azure.com'
85
- self ._config = AzureArcVMwareManagementServiceAPIConfiguration (credential , subscription_id , ** kwargs )
67
+ credential : "TokenCredential" ,
68
+ subscription_id : str ,
69
+ base_url : str = "https://management.azure.com" ,
70
+ ** kwargs : Any
71
+ ) -> None :
72
+ self ._config = AzureArcVMwareManagementServiceAPIConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
86
73
self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
87
74
88
75
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
89
76
self ._serialize = Serializer (client_models )
90
- self ._serialize .client_side_validation = False
91
77
self ._deserialize = Deserializer (client_models )
92
-
93
- self .operations = Operations (
94
- self ._client , self ._config , self ._serialize , self ._deserialize )
95
- self .resource_pools = ResourcePoolsOperations (
96
- self ._client , self ._config , self ._serialize , self ._deserialize )
97
- self .clusters = ClustersOperations (
98
- self ._client , self ._config , self ._serialize , self ._deserialize )
99
- self .hosts = HostsOperations (
100
- self ._client , self ._config , self ._serialize , self ._deserialize )
101
- self .datastores = DatastoresOperations (
102
- self ._client , self ._config , self ._serialize , self ._deserialize )
103
- self .vcenters = VCentersOperations (
104
- self ._client , self ._config , self ._serialize , self ._deserialize )
105
- self .virtual_machines = VirtualMachinesOperations (
106
- self ._client , self ._config , self ._serialize , self ._deserialize )
107
- self .virtual_machine_templates = VirtualMachineTemplatesOperations (
108
- self ._client , self ._config , self ._serialize , self ._deserialize )
109
- self .virtual_networks = VirtualNetworksOperations (
110
- self ._client , self ._config , self ._serialize , self ._deserialize )
111
- self .inventory_items = InventoryItemsOperations (
112
- self ._client , self ._config , self ._serialize , self ._deserialize )
113
- self .hybrid_identity_metadata = HybridIdentityMetadataOperations (
114
- self ._client , self ._config , self ._serialize , self ._deserialize )
115
- self .machine_extensions = MachineExtensionsOperations (
116
- self ._client , self ._config , self ._serialize , self ._deserialize )
117
- self .guest_agents = GuestAgentsOperations (
118
- self ._client , self ._config , self ._serialize , self ._deserialize )
119
-
120
- def _send_request (self , http_request , ** kwargs ):
121
- # type: (HttpRequest, Any) -> HttpResponse
78
+ self ._serialize .client_side_validation = False
79
+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
80
+ self .resource_pools = ResourcePoolsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
81
+ self .clusters = ClustersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
82
+ self .hosts = HostsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
83
+ self .datastores = DatastoresOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
84
+ self .vcenters = VCentersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
85
+ self .virtual_machines = VirtualMachinesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
86
+ self .virtual_machine_templates = VirtualMachineTemplatesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
87
+ self .virtual_networks = VirtualNetworksOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
88
+ self .inventory_items = InventoryItemsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
89
+ self .hybrid_identity_metadata = HybridIdentityMetadataOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
90
+ self .machine_extensions = MachineExtensionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
91
+ self .guest_agents = GuestAgentsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
92
+
93
+
94
+ def _send_request (
95
+ self ,
96
+ request , # type: HttpRequest
97
+ ** kwargs : Any
98
+ ) -> HttpResponse :
122
99
"""Runs the network request through the client's chained policies.
123
100
124
- :param http_request: The network request you want to make. Required.
125
- :type http_request: ~azure.core.pipeline.transport.HttpRequest
126
- :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
101
+ >>> from azure.core.rest import HttpRequest
102
+ >>> request = HttpRequest("GET", "https://www.example.org/")
103
+ <HttpRequest [GET], url: 'https://www.example.org/'>
104
+ >>> response = client._send_request(request)
105
+ <HttpResponse: 200 OK>
106
+
107
+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
108
+
109
+ :param request: The network request you want to make. Required.
110
+ :type request: ~azure.core.rest.HttpRequest
111
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
127
112
:return: The response of your network call. Does not do error handling on your response.
128
- :rtype: ~azure.core.pipeline.transport .HttpResponse
113
+ :rtype: ~azure.core.rest .HttpResponse
129
114
"""
130
- path_format_arguments = {
131
- 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' ),
132
- }
133
- http_request .url = self ._client .format_url (http_request .url , ** path_format_arguments )
134
- stream = kwargs .pop ("stream" , True )
135
- pipeline_response = self ._client ._pipeline .run (http_request , stream = stream , ** kwargs )
136
- return pipeline_response .http_response
115
+
116
+ request_copy = deepcopy (request )
117
+ request_copy .url = self ._client .format_url (request_copy .url )
118
+ return self ._client .send_request (request_copy , ** kwargs )
137
119
138
120
def close (self ):
139
121
# type: () -> None
0 commit comments