13
13
from msrest import Serializer , Deserializer
14
14
from msrestazure import AzureConfiguration
15
15
from .version import VERSION
16
+ from msrest .pipeline import ClientRawResponse
17
+ from msrestazure .azure_exceptions import CloudError
18
+ from msrest .polling import LROPoller , NoPolling
19
+ from msrestazure .polling .arm_polling import ARMPolling
20
+ import uuid
16
21
from .operations .operations import Operations
17
22
from .operations .accounts_operations import AccountsOperations
18
23
from .operations .pools_operations import PoolsOperations
@@ -92,7 +97,7 @@ def __init__(
92
97
super (AzureNetAppFilesManagementClient , self ).__init__ (self .config .credentials , self .config )
93
98
94
99
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
95
- self .api_version = '2017-08-15 '
100
+ self .api_version = '2019-05-01 '
96
101
self ._serialize = Serializer (client_models )
97
102
self ._deserialize = Deserializer (client_models )
98
103
@@ -108,3 +113,125 @@ def __init__(
108
113
self ._client , self .config , self ._serialize , self ._deserialize )
109
114
self .snapshots = SnapshotsOperations (
110
115
self ._client , self .config , self ._serialize , self ._deserialize )
116
+
117
+ def check_name_availability (
118
+ self , location , custom_headers = None , raw = False , ** operation_config ):
119
+ """Check resource name availability.
120
+
121
+ Check if a resource name is available.
122
+
123
+ :param location: The location
124
+ :type location: str
125
+ :param dict custom_headers: headers that will be added to the request
126
+ :param bool raw: returns the direct response alongside the
127
+ deserialized response
128
+ :param operation_config: :ref:`Operation configuration
129
+ overrides<msrest:optionsforoperations>`.
130
+ :return: ResourceNameAvailability or ClientRawResponse if raw=true
131
+ :rtype: ~azure.mgmt.netapp.models.ResourceNameAvailability or
132
+ ~msrest.pipeline.ClientRawResponse
133
+ :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
134
+ """
135
+ # Construct URL
136
+ url = self .check_name_availability .metadata ['url' ]
137
+ path_format_arguments = {
138
+ 'subscriptionId' : self ._serialize .url ("self.config.subscription_id" , self .config .subscription_id , 'str' ),
139
+ 'location' : self ._serialize .url ("location" , location , 'str' )
140
+ }
141
+ url = self ._client .format_url (url , ** path_format_arguments )
142
+
143
+ # Construct parameters
144
+ query_parameters = {}
145
+ query_parameters ['api-version' ] = self ._serialize .query ("self.api_version" , self .api_version , 'str' )
146
+
147
+ # Construct headers
148
+ header_parameters = {}
149
+ header_parameters ['Accept' ] = 'application/json'
150
+ if self .config .generate_client_request_id :
151
+ header_parameters ['x-ms-client-request-id' ] = str (uuid .uuid1 ())
152
+ if custom_headers :
153
+ header_parameters .update (custom_headers )
154
+ if self .config .accept_language is not None :
155
+ header_parameters ['accept-language' ] = self ._serialize .header ("self.config.accept_language" , self .config .accept_language , 'str' )
156
+
157
+ # Construct and send request
158
+ request = self ._client .post (url , query_parameters , header_parameters )
159
+ response = self ._client .send (request , stream = False , ** operation_config )
160
+
161
+ if response .status_code not in [200 ]:
162
+ exp = CloudError (response )
163
+ exp .request_id = response .headers .get ('x-ms-request-id' )
164
+ raise exp
165
+
166
+ deserialized = None
167
+
168
+ if response .status_code == 200 :
169
+ deserialized = self ._deserialize ('ResourceNameAvailability' , response )
170
+
171
+ if raw :
172
+ client_raw_response = ClientRawResponse (deserialized , response )
173
+ return client_raw_response
174
+
175
+ return deserialized
176
+ check_name_availability .metadata = {'url' : '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability' }
177
+
178
+ def check_file_path_availability (
179
+ self , location , custom_headers = None , raw = False , ** operation_config ):
180
+ """Check file path availability.
181
+
182
+ Check if a file path is available.
183
+
184
+ :param location: The location
185
+ :type location: str
186
+ :param dict custom_headers: headers that will be added to the request
187
+ :param bool raw: returns the direct response alongside the
188
+ deserialized response
189
+ :param operation_config: :ref:`Operation configuration
190
+ overrides<msrest:optionsforoperations>`.
191
+ :return: ResourceNameAvailability or ClientRawResponse if raw=true
192
+ :rtype: ~azure.mgmt.netapp.models.ResourceNameAvailability or
193
+ ~msrest.pipeline.ClientRawResponse
194
+ :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
195
+ """
196
+ # Construct URL
197
+ url = self .check_file_path_availability .metadata ['url' ]
198
+ path_format_arguments = {
199
+ 'subscriptionId' : self ._serialize .url ("self.config.subscription_id" , self .config .subscription_id , 'str' ),
200
+ 'location' : self ._serialize .url ("location" , location , 'str' )
201
+ }
202
+ url = self ._client .format_url (url , ** path_format_arguments )
203
+
204
+ # Construct parameters
205
+ query_parameters = {}
206
+ query_parameters ['api-version' ] = self ._serialize .query ("self.api_version" , self .api_version , 'str' )
207
+
208
+ # Construct headers
209
+ header_parameters = {}
210
+ header_parameters ['Accept' ] = 'application/json'
211
+ if self .config .generate_client_request_id :
212
+ header_parameters ['x-ms-client-request-id' ] = str (uuid .uuid1 ())
213
+ if custom_headers :
214
+ header_parameters .update (custom_headers )
215
+ if self .config .accept_language is not None :
216
+ header_parameters ['accept-language' ] = self ._serialize .header ("self.config.accept_language" , self .config .accept_language , 'str' )
217
+
218
+ # Construct and send request
219
+ request = self ._client .post (url , query_parameters , header_parameters )
220
+ response = self ._client .send (request , stream = False , ** operation_config )
221
+
222
+ if response .status_code not in [200 ]:
223
+ exp = CloudError (response )
224
+ exp .request_id = response .headers .get ('x-ms-request-id' )
225
+ raise exp
226
+
227
+ deserialized = None
228
+
229
+ if response .status_code == 200 :
230
+ deserialized = self ._deserialize ('ResourceNameAvailability' , response )
231
+
232
+ if raw :
233
+ client_raw_response = ClientRawResponse (deserialized , response )
234
+ return client_raw_response
235
+
236
+ return deserialized
237
+ check_file_path_availability .metadata = {'url' : '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability' }
0 commit comments