6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
# --------------------------------------------------------------------------
8
8
9
+ from copy import deepcopy
9
10
from typing import TYPE_CHECKING
10
11
11
12
from azure .mgmt .core import ARMPipelineClient
12
13
from msrest import Deserializer , Serializer
13
14
15
+ from . import models
16
+ from ._configuration import NetAppManagementClientConfiguration
17
+ from .operations import AccountBackupsOperations , AccountsOperations , BackupPoliciesOperations , BackupsOperations , NetAppResourceOperations , NetAppResourceQuotaLimitsOperations , Operations , PoolsOperations , SnapshotPoliciesOperations , SnapshotsOperations , VaultsOperations , VolumeGroupsOperations , VolumesOperations
18
+
14
19
if TYPE_CHECKING :
15
20
# pylint: disable=unused-import,ungrouped-imports
16
21
from typing import Any , Optional
17
22
18
23
from azure .core .credentials import TokenCredential
19
- from azure .core .pipeline .transport import HttpRequest , HttpResponse
20
-
21
- from ._configuration import NetAppManagementClientConfiguration
22
- from .operations import Operations
23
- from .operations import NetAppResourceOperations
24
- from .operations import NetAppResourceQuotaLimitsOperations
25
- from .operations import AccountsOperations
26
- from .operations import PoolsOperations
27
- from .operations import VolumesOperations
28
- from .operations import SnapshotsOperations
29
- from .operations import SnapshotPoliciesOperations
30
- from .operations import BackupsOperations
31
- from .operations import AccountBackupsOperations
32
- from .operations import BackupPoliciesOperations
33
- from .operations import VaultsOperations
34
- from . import models
35
-
24
+ from azure .core .rest import HttpRequest , HttpResponse
36
25
37
26
class NetAppManagementClient (object ):
38
27
"""Microsoft NetApp Files Azure Resource Provider specification.
@@ -42,7 +31,8 @@ class NetAppManagementClient(object):
42
31
:ivar net_app_resource: NetAppResourceOperations operations
43
32
:vartype net_app_resource: azure.mgmt.netapp.operations.NetAppResourceOperations
44
33
:ivar net_app_resource_quota_limits: NetAppResourceQuotaLimitsOperations operations
45
- :vartype net_app_resource_quota_limits: azure.mgmt.netapp.operations.NetAppResourceQuotaLimitsOperations
34
+ :vartype net_app_resource_quota_limits:
35
+ azure.mgmt.netapp.operations.NetAppResourceQuotaLimitsOperations
46
36
:ivar accounts: AccountsOperations operations
47
37
:vartype accounts: azure.mgmt.netapp.operations.AccountsOperations
48
38
:ivar pools: PoolsOperations operations
@@ -61,74 +51,75 @@ class NetAppManagementClient(object):
61
51
:vartype backup_policies: azure.mgmt.netapp.operations.BackupPoliciesOperations
62
52
:ivar vaults: VaultsOperations operations
63
53
:vartype vaults: azure.mgmt.netapp.operations.VaultsOperations
54
+ :ivar volume_groups: VolumeGroupsOperations operations
55
+ :vartype volume_groups: azure.mgmt.netapp.operations.VolumeGroupsOperations
64
56
:param credential: Credential needed for the client to connect to Azure.
65
57
:type credential: ~azure.core.credentials.TokenCredential
66
- :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
58
+ :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure
59
+ subscription. The subscription ID forms part of the URI for every service call.
67
60
:type subscription_id: str
68
- :param str base_url: Service URL
69
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
61
+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
62
+ :type base_url: str
63
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
64
+ Retry-After header is present.
70
65
"""
71
66
72
67
def __init__ (
73
68
self ,
74
69
credential , # type: "TokenCredential"
75
70
subscription_id , # type: str
76
- base_url = None , # type: Optional[ str]
71
+ base_url = "https://management.azure.com" , # type: str
77
72
** kwargs # type: Any
78
73
):
79
74
# type: (...) -> None
80
- if not base_url :
81
- base_url = 'https://management.azure.com'
82
- self ._config = NetAppManagementClientConfiguration (credential , subscription_id , ** kwargs )
75
+ self ._config = NetAppManagementClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
83
76
self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
84
77
85
78
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
86
79
self ._serialize = Serializer (client_models )
87
- self ._serialize .client_side_validation = False
88
80
self ._deserialize = Deserializer (client_models )
89
-
90
- self .operations = Operations (
91
- self ._client , self ._config , self ._serialize , self ._deserialize )
92
- self .net_app_resource = NetAppResourceOperations (
93
- self ._client , self ._config , self ._serialize , self ._deserialize )
94
- self .net_app_resource_quota_limits = NetAppResourceQuotaLimitsOperations (
95
- self ._client , self ._config , self ._serialize , self ._deserialize )
96
- self .accounts = AccountsOperations (
97
- self ._client , self ._config , self ._serialize , self ._deserialize )
98
- self .pools = PoolsOperations (
99
- self ._client , self ._config , self ._serialize , self ._deserialize )
100
- self .volumes = VolumesOperations (
101
- self ._client , self ._config , self ._serialize , self ._deserialize )
102
- self .snapshots = SnapshotsOperations (
103
- self ._client , self ._config , self ._serialize , self ._deserialize )
104
- self .snapshot_policies = SnapshotPoliciesOperations (
105
- self ._client , self ._config , self ._serialize , self ._deserialize )
106
- self .backups = BackupsOperations (
107
- self ._client , self ._config , self ._serialize , self ._deserialize )
108
- self .account_backups = AccountBackupsOperations (
109
- self ._client , self ._config , self ._serialize , self ._deserialize )
110
- self .backup_policies = BackupPoliciesOperations (
111
- self ._client , self ._config , self ._serialize , self ._deserialize )
112
- self .vaults = VaultsOperations (
113
- self ._client , self ._config , self ._serialize , self ._deserialize )
114
-
115
- def _send_request (self , http_request , ** kwargs ):
116
- # type: (HttpRequest, Any) -> HttpResponse
81
+ self ._serialize .client_side_validation = False
82
+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
83
+ self .net_app_resource = NetAppResourceOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
84
+ self .net_app_resource_quota_limits = NetAppResourceQuotaLimitsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
85
+ self .accounts = AccountsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
86
+ self .pools = PoolsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
87
+ self .volumes = VolumesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
88
+ self .snapshots = SnapshotsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
89
+ self .snapshot_policies = SnapshotPoliciesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
90
+ self .backups = BackupsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
91
+ self .account_backups = AccountBackupsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
92
+ self .backup_policies = BackupPoliciesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
93
+ self .vaults = VaultsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
94
+ self .volume_groups = VolumeGroupsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
95
+
96
+
97
+ def _send_request (
98
+ self ,
99
+ request , # type: HttpRequest
100
+ ** kwargs # type: Any
101
+ ):
102
+ # type: (...) -> HttpResponse
117
103
"""Runs the network request through the client's chained policies.
118
104
119
- :param http_request: The network request you want to make. Required.
120
- :type http_request: ~azure.core.pipeline.transport.HttpRequest
121
- :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
105
+ >>> from azure.core.rest import HttpRequest
106
+ >>> request = HttpRequest("GET", "https://www.example.org/")
107
+ <HttpRequest [GET], url: 'https://www.example.org/'>
108
+ >>> response = client._send_request(request)
109
+ <HttpResponse: 200 OK>
110
+
111
+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
112
+
113
+ :param request: The network request you want to make. Required.
114
+ :type request: ~azure.core.rest.HttpRequest
115
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
122
116
:return: The response of your network call. Does not do error handling on your response.
123
- :rtype: ~azure.core.pipeline.transport .HttpResponse
117
+ :rtype: ~azure.core.rest .HttpResponse
124
118
"""
125
- path_format_arguments = {
126
- 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' ),
127
- }
128
- http_request .url = self ._client .format_url (http_request .url , ** path_format_arguments )
129
- stream = kwargs .pop ("stream" , True )
130
- pipeline_response = self ._client ._pipeline .run (http_request , stream = stream , ** kwargs )
131
- return pipeline_response .http_response
119
+
120
+ request_copy = deepcopy (request )
121
+ request_copy .url = self ._client .format_url (request_copy .url )
122
+ return self ._client .send_request (request_copy , ** kwargs )
132
123
133
124
def close (self ):
134
125
# type: () -> None
0 commit comments