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 AzureStackManagementClientConfiguration
18
+ from .operations import CloudManifestFileOperations , CustomerSubscriptionsOperations , LinkedSubscriptionsOperations , Operations , ProductsOperations , RegistrationsOperations
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
23
20
- from ._configuration import AzureStackManagementClientConfiguration
21
- from .operations import Operations
22
- from .operations import CloudManifestFileOperations
23
- from .operations import CustomerSubscriptionsOperations
24
- from .operations import ProductsOperations
25
- from .operations import RegistrationsOperations
26
- from .operations import LinkedSubscriptionsOperations
27
- from . import models
28
-
29
-
30
- class AzureStackManagementClient (object ):
24
+ class AzureStackManagementClient :
31
25
"""Azure Stack.
32
26
33
27
:ivar operations: Operations operations
34
28
:vartype operations: azure.mgmt.azurestack.operations.Operations
35
29
:ivar cloud_manifest_file: CloudManifestFileOperations operations
36
30
:vartype cloud_manifest_file: azure.mgmt.azurestack.operations.CloudManifestFileOperations
37
31
:ivar customer_subscriptions: CustomerSubscriptionsOperations operations
38
- :vartype customer_subscriptions: azure.mgmt.azurestack.operations.CustomerSubscriptionsOperations
32
+ :vartype customer_subscriptions:
33
+ azure.mgmt.azurestack.operations.CustomerSubscriptionsOperations
39
34
:ivar products: ProductsOperations operations
40
35
:vartype products: azure.mgmt.azurestack.operations.ProductsOperations
41
36
:ivar registrations: RegistrationsOperations operations
@@ -44,41 +39,60 @@ class AzureStackManagementClient(object):
44
39
:vartype linked_subscriptions: azure.mgmt.azurestack.operations.LinkedSubscriptionsOperations
45
40
:param credential: Credential needed for the client to connect to Azure.
46
41
:type credential: ~azure.core.credentials.TokenCredential
47
- :param subscription_id: Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
42
+ :param subscription_id: Subscription credentials that uniquely identify Microsoft Azure
43
+ subscription. The subscription ID forms part of the URI for every service call.
48
44
:type subscription_id: str
49
- :param str base_url: Service URL
45
+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
46
+ :type base_url: str
50
47
"""
51
48
52
49
def __init__ (
53
50
self ,
54
- credential , # type: "TokenCredential"
55
- subscription_id , # type: str
56
- base_url = None , # type: Optional[str]
57
- ** kwargs # type: Any
58
- ):
59
- # type: (...) -> None
60
- if not base_url :
61
- base_url = 'https://management.azure.com'
62
- self ._config = AzureStackManagementClientConfiguration (credential , subscription_id , ** kwargs )
51
+ credential : "TokenCredential" ,
52
+ subscription_id : str ,
53
+ base_url : str = "https://management.azure.com" ,
54
+ ** kwargs : Any
55
+ ) -> None :
56
+ self ._config = AzureStackManagementClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
63
57
self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
64
58
65
59
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
66
60
self ._serialize = Serializer (client_models )
67
- self ._serialize .client_side_validation = False
68
61
self ._deserialize = Deserializer (client_models )
62
+ self ._serialize .client_side_validation = False
63
+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
64
+ self .cloud_manifest_file = CloudManifestFileOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
65
+ self .customer_subscriptions = CustomerSubscriptionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
66
+ self .products = ProductsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
67
+ self .registrations = RegistrationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
68
+ self .linked_subscriptions = LinkedSubscriptionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
69
+
70
+
71
+ def _send_request (
72
+ self ,
73
+ request , # type: HttpRequest
74
+ ** kwargs : Any
75
+ ) -> HttpResponse :
76
+ """Runs the network request through the client's chained policies.
77
+
78
+ >>> from azure.core.rest import HttpRequest
79
+ >>> request = HttpRequest("GET", "https://www.example.org/")
80
+ <HttpRequest [GET], url: 'https://www.example.org/'>
81
+ >>> response = client._send_request(request)
82
+ <HttpResponse: 200 OK>
83
+
84
+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
85
+
86
+ :param request: The network request you want to make. Required.
87
+ :type request: ~azure.core.rest.HttpRequest
88
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
89
+ :return: The response of your network call. Does not do error handling on your response.
90
+ :rtype: ~azure.core.rest.HttpResponse
91
+ """
69
92
70
- self .operations = Operations (
71
- self ._client , self ._config , self ._serialize , self ._deserialize )
72
- self .cloud_manifest_file = CloudManifestFileOperations (
73
- self ._client , self ._config , self ._serialize , self ._deserialize )
74
- self .customer_subscriptions = CustomerSubscriptionsOperations (
75
- self ._client , self ._config , self ._serialize , self ._deserialize )
76
- self .products = ProductsOperations (
77
- self ._client , self ._config , self ._serialize , self ._deserialize )
78
- self .registrations = RegistrationsOperations (
79
- self ._client , self ._config , self ._serialize , self ._deserialize )
80
- self .linked_subscriptions = LinkedSubscriptionsOperations (
81
- self ._client , self ._config , self ._serialize , self ._deserialize )
93
+ request_copy = deepcopy (request )
94
+ request_copy .url = self ._client .format_url (request_copy .url )
95
+ return self ._client .send_request (request_copy , ** kwargs )
82
96
83
97
def close (self ):
84
98
# type: () -> None
0 commit comments