azure_mgmt_storage 0.17.10 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2015-05-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  3. data/lib/2015-06-15/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  4. data/lib/2016-01-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  5. data/lib/2016-12-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  6. data/lib/2017-06-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  7. data/lib/2017-10-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  8. data/lib/2018-02-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  9. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  10. data/lib/2018-07-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  11. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  12. data/lib/2019-04-01/generated/azure_mgmt_storage.rb +49 -38
  13. data/lib/2019-04-01/generated/azure_mgmt_storage/blob_containers.rb +151 -8
  14. data/lib/2019-04-01/generated/azure_mgmt_storage/blob_services.rb +113 -0
  15. data/lib/2019-04-01/generated/azure_mgmt_storage/file_services.rb +377 -0
  16. data/lib/2019-04-01/generated/azure_mgmt_storage/file_shares.rb +806 -0
  17. data/lib/2019-04-01/generated/azure_mgmt_storage/models/azure_files_identity_based_authentication.rb +47 -0
  18. data/lib/2019-04-01/generated/azure_mgmt_storage/models/blob_service_items.rb +57 -0
  19. data/lib/2019-04-01/generated/azure_mgmt_storage/models/blob_service_properties.rb +13 -0
  20. data/lib/2019-04-01/generated/azure_mgmt_storage/models/change_feed.rb +47 -0
  21. data/lib/2019-04-01/generated/azure_mgmt_storage/models/date_after_creation.rb +4 -4
  22. data/lib/2019-04-01/generated/azure_mgmt_storage/models/date_after_modification.rb +4 -3
  23. data/lib/2019-04-01/generated/azure_mgmt_storage/models/directory_service_options.rb +16 -0
  24. data/lib/2019-04-01/generated/azure_mgmt_storage/models/file_service_items.rb +57 -0
  25. data/lib/2019-04-01/generated/azure_mgmt_storage/models/file_service_properties.rb +77 -0
  26. data/lib/2019-04-01/generated/azure_mgmt_storage/models/file_share.rb +121 -0
  27. data/lib/2019-04-01/generated/azure_mgmt_storage/models/file_share_item.rb +120 -0
  28. data/lib/2019-04-01/generated/azure_mgmt_storage/models/file_share_items.rb +103 -0
  29. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_container_items.rb +50 -2
  30. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account.rb +7 -6
  31. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_create_parameters.rb +10 -10
  32. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_update_parameters.rb +7 -6
  33. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_management_client.rb +9 -1
  34. data/lib/azure_mgmt_storage.rb +8 -8
  35. data/lib/profiles/latest/modules/storage_profile_module.rb +165 -125
  36. data/lib/version.rb +1 -1
  37. metadata +14 -3
@@ -0,0 +1,377 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_04_01
7
+ #
8
+ # The Azure Storage Management API.
9
+ #
10
+ class FileServices
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the FileServices class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [StorageManagementClient] reference to the StorageManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # List all file services in storage accounts
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group within the
28
+ # user's subscription. The name is case insensitive.
29
+ # @param account_name [String] The name of the storage account within the
30
+ # specified resource group. Storage account names must be between 3 and 24
31
+ # characters in length and use numbers and lower-case letters only.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [FileServiceItems] operation results.
36
+ #
37
+ def list(resource_group_name, account_name, custom_headers:nil)
38
+ response = list_async(resource_group_name, account_name, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # List all file services in storage accounts
44
+ #
45
+ # @param resource_group_name [String] The name of the resource group within the
46
+ # user's subscription. The name is case insensitive.
47
+ # @param account_name [String] The name of the storage account within the
48
+ # specified resource group. Storage account names must be between 3 and 24
49
+ # characters in length and use numbers and lower-case letters only.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_with_http_info(resource_group_name, account_name, custom_headers:nil)
56
+ list_async(resource_group_name, account_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # List all file services in storage accounts
61
+ #
62
+ # @param resource_group_name [String] The name of the resource group within the
63
+ # user's subscription. The name is case insensitive.
64
+ # @param account_name [String] The name of the storage account within the
65
+ # specified resource group. Storage account names must be between 3 and 24
66
+ # characters in length and use numbers and lower-case letters only.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_async(resource_group_name, account_name, custom_headers:nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
75
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
76
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
77
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
78
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
79
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
84
+
85
+
86
+ request_headers = {}
87
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
88
+
89
+ # Set Headers
90
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
91
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
92
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'
93
+
94
+ request_url = @base_url || @client.base_url
95
+
96
+ options = {
97
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
98
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
99
+ query_params: {'api-version' => @client.api_version},
100
+ headers: request_headers.merge(custom_headers || {}),
101
+ base_url: request_url
102
+ }
103
+ promise = @client.make_request_async(:get, path_template, options)
104
+
105
+ promise = promise.then do |result|
106
+ http_response = result.response
107
+ status_code = http_response.status
108
+ response_content = http_response.body
109
+ unless status_code == 200
110
+ error_model = JSON.load(response_content)
111
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
112
+ end
113
+
114
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
115
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
116
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 200
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileServiceItems.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response)
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+
128
+ result
129
+ end
130
+
131
+ promise.execute
132
+ end
133
+
134
+ #
135
+ # Sets the properties of file services in storage accounts, including CORS
136
+ # (Cross-Origin Resource Sharing) rules.
137
+ #
138
+ # @param resource_group_name [String] The name of the resource group within the
139
+ # user's subscription. The name is case insensitive.
140
+ # @param account_name [String] The name of the storage account within the
141
+ # specified resource group. Storage account names must be between 3 and 24
142
+ # characters in length and use numbers and lower-case letters only.
143
+ # @param parameters [FileServiceProperties] The properties of file services in
144
+ # storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [FileServiceProperties] operation results.
149
+ #
150
+ def set_service_properties(resource_group_name, account_name, parameters, custom_headers:nil)
151
+ response = set_service_properties_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
152
+ response.body unless response.nil?
153
+ end
154
+
155
+ #
156
+ # Sets the properties of file services in storage accounts, including CORS
157
+ # (Cross-Origin Resource Sharing) rules.
158
+ #
159
+ # @param resource_group_name [String] The name of the resource group within the
160
+ # user's subscription. The name is case insensitive.
161
+ # @param account_name [String] The name of the storage account within the
162
+ # specified resource group. Storage account names must be between 3 and 24
163
+ # characters in length and use numbers and lower-case letters only.
164
+ # @param parameters [FileServiceProperties] The properties of file services in
165
+ # storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
167
+ # will be added to the HTTP request.
168
+ #
169
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
170
+ #
171
+ def set_service_properties_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
172
+ set_service_properties_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
173
+ end
174
+
175
+ #
176
+ # Sets the properties of file services in storage accounts, including CORS
177
+ # (Cross-Origin Resource Sharing) rules.
178
+ #
179
+ # @param resource_group_name [String] The name of the resource group within the
180
+ # user's subscription. The name is case insensitive.
181
+ # @param account_name [String] The name of the storage account within the
182
+ # specified resource group. Storage account names must be between 3 and 24
183
+ # characters in length and use numbers and lower-case letters only.
184
+ # @param parameters [FileServiceProperties] The properties of file services in
185
+ # storage accounts, including CORS (Cross-Origin Resource Sharing) rules.
186
+ # @param [Hash{String => String}] A hash of custom headers that will be added
187
+ # to the HTTP request.
188
+ #
189
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
190
+ #
191
+ def set_service_properties_async(resource_group_name, account_name, parameters, custom_headers:nil)
192
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
193
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
194
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
195
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
196
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
197
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
198
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
199
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
200
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
201
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
202
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
203
+ file_services_name = 'default'
204
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
205
+
206
+
207
+ request_headers = {}
208
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
209
+
210
+ # Set Headers
211
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
212
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
213
+
214
+ # Serialize Request
215
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileServiceProperties.mapper()
216
+ request_content = @client.serialize(request_mapper, parameters)
217
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
218
+
219
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'
220
+
221
+ request_url = @base_url || @client.base_url
222
+
223
+ options = {
224
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
225
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'FileServicesName' => file_services_name},
226
+ query_params: {'api-version' => @client.api_version},
227
+ body: request_content,
228
+ headers: request_headers.merge(custom_headers || {}),
229
+ base_url: request_url
230
+ }
231
+ promise = @client.make_request_async(:put, path_template, options)
232
+
233
+ promise = promise.then do |result|
234
+ http_response = result.response
235
+ status_code = http_response.status
236
+ response_content = http_response.body
237
+ unless status_code == 200
238
+ error_model = JSON.load(response_content)
239
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
240
+ end
241
+
242
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
243
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
244
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
245
+ # Deserialize Response
246
+ if status_code == 200
247
+ begin
248
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
249
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileServiceProperties.mapper()
250
+ result.body = @client.deserialize(result_mapper, parsed_response)
251
+ rescue Exception => e
252
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
253
+ end
254
+ end
255
+
256
+ result
257
+ end
258
+
259
+ promise.execute
260
+ end
261
+
262
+ #
263
+ # Gets the properties of file services in storage accounts, including CORS
264
+ # (Cross-Origin Resource Sharing) rules.
265
+ #
266
+ # @param resource_group_name [String] The name of the resource group within the
267
+ # user's subscription. The name is case insensitive.
268
+ # @param account_name [String] The name of the storage account within the
269
+ # specified resource group. Storage account names must be between 3 and 24
270
+ # characters in length and use numbers and lower-case letters only.
271
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
272
+ # will be added to the HTTP request.
273
+ #
274
+ # @return [FileServiceProperties] operation results.
275
+ #
276
+ def get_service_properties(resource_group_name, account_name, custom_headers:nil)
277
+ response = get_service_properties_async(resource_group_name, account_name, custom_headers:custom_headers).value!
278
+ response.body unless response.nil?
279
+ end
280
+
281
+ #
282
+ # Gets the properties of file services in storage accounts, including CORS
283
+ # (Cross-Origin Resource Sharing) rules.
284
+ #
285
+ # @param resource_group_name [String] The name of the resource group within the
286
+ # user's subscription. The name is case insensitive.
287
+ # @param account_name [String] The name of the storage account within the
288
+ # specified resource group. Storage account names must be between 3 and 24
289
+ # characters in length and use numbers and lower-case letters only.
290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
291
+ # will be added to the HTTP request.
292
+ #
293
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
294
+ #
295
+ def get_service_properties_with_http_info(resource_group_name, account_name, custom_headers:nil)
296
+ get_service_properties_async(resource_group_name, account_name, custom_headers:custom_headers).value!
297
+ end
298
+
299
+ #
300
+ # Gets the properties of file services in storage accounts, including CORS
301
+ # (Cross-Origin Resource Sharing) rules.
302
+ #
303
+ # @param resource_group_name [String] The name of the resource group within the
304
+ # user's subscription. The name is case insensitive.
305
+ # @param account_name [String] The name of the storage account within the
306
+ # specified resource group. Storage account names must be between 3 and 24
307
+ # characters in length and use numbers and lower-case letters only.
308
+ # @param [Hash{String => String}] A hash of custom headers that will be added
309
+ # to the HTTP request.
310
+ #
311
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
312
+ #
313
+ def get_service_properties_async(resource_group_name, account_name, custom_headers:nil)
314
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
315
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
316
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
317
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
318
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
319
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
320
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
321
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
322
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
323
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
324
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
325
+ file_services_name = 'default'
326
+
327
+
328
+ request_headers = {}
329
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
330
+
331
+ # Set Headers
332
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
333
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
334
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'
335
+
336
+ request_url = @base_url || @client.base_url
337
+
338
+ options = {
339
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
340
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'FileServicesName' => file_services_name},
341
+ query_params: {'api-version' => @client.api_version},
342
+ headers: request_headers.merge(custom_headers || {}),
343
+ base_url: request_url
344
+ }
345
+ promise = @client.make_request_async(:get, path_template, options)
346
+
347
+ promise = promise.then do |result|
348
+ http_response = result.response
349
+ status_code = http_response.status
350
+ response_content = http_response.body
351
+ unless status_code == 200
352
+ error_model = JSON.load(response_content)
353
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
354
+ end
355
+
356
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
357
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
358
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
359
+ # Deserialize Response
360
+ if status_code == 200
361
+ begin
362
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
363
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileServiceProperties.mapper()
364
+ result.body = @client.deserialize(result_mapper, parsed_response)
365
+ rescue Exception => e
366
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
367
+ end
368
+ end
369
+
370
+ result
371
+ end
372
+
373
+ promise.execute
374
+ end
375
+
376
+ end
377
+ end
@@ -0,0 +1,806 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_04_01
7
+ #
8
+ # The Azure Storage Management API.
9
+ #
10
+ class FileShares
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the FileShares class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [StorageManagementClient] reference to the StorageManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists all shares.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group within the
28
+ # user's subscription. The name is case insensitive.
29
+ # @param account_name [String] The name of the storage account within the
30
+ # specified resource group. Storage account names must be between 3 and 24
31
+ # characters in length and use numbers and lower-case letters only.
32
+ # @param skip_token [String] Optional. Continuation token for the list
33
+ # operation.
34
+ # @param maxpagesize [String] Optional. Specified maximum number of shares that
35
+ # can be included in the list.
36
+ # @param filter [String] Optional. When specified, only share names starting
37
+ # with the filter will be listed.
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [Array<FileShareItem>] operation results.
42
+ #
43
+ def list(resource_group_name, account_name, skip_token:nil, maxpagesize:nil, filter:nil, custom_headers:nil)
44
+ first_page = list_as_lazy(resource_group_name, account_name, skip_token:skip_token, maxpagesize:maxpagesize, filter:filter, custom_headers:custom_headers)
45
+ first_page.get_all_items
46
+ end
47
+
48
+ #
49
+ # Lists all shares.
50
+ #
51
+ # @param resource_group_name [String] The name of the resource group within the
52
+ # user's subscription. The name is case insensitive.
53
+ # @param account_name [String] The name of the storage account within the
54
+ # specified resource group. Storage account names must be between 3 and 24
55
+ # characters in length and use numbers and lower-case letters only.
56
+ # @param skip_token [String] Optional. Continuation token for the list
57
+ # operation.
58
+ # @param maxpagesize [String] Optional. Specified maximum number of shares that
59
+ # can be included in the list.
60
+ # @param filter [String] Optional. When specified, only share names starting
61
+ # with the filter will be listed.
62
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
63
+ # will be added to the HTTP request.
64
+ #
65
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
66
+ #
67
+ def list_with_http_info(resource_group_name, account_name, skip_token:nil, maxpagesize:nil, filter:nil, custom_headers:nil)
68
+ list_async(resource_group_name, account_name, skip_token:skip_token, maxpagesize:maxpagesize, filter:filter, custom_headers:custom_headers).value!
69
+ end
70
+
71
+ #
72
+ # Lists all shares.
73
+ #
74
+ # @param resource_group_name [String] The name of the resource group within the
75
+ # user's subscription. The name is case insensitive.
76
+ # @param account_name [String] The name of the storage account within the
77
+ # specified resource group. Storage account names must be between 3 and 24
78
+ # characters in length and use numbers and lower-case letters only.
79
+ # @param skip_token [String] Optional. Continuation token for the list
80
+ # operation.
81
+ # @param maxpagesize [String] Optional. Specified maximum number of shares that
82
+ # can be included in the list.
83
+ # @param filter [String] Optional. When specified, only share names starting
84
+ # with the filter will be listed.
85
+ # @param [Hash{String => String}] A hash of custom headers that will be added
86
+ # to the HTTP request.
87
+ #
88
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
89
+ #
90
+ def list_async(resource_group_name, account_name, skip_token:nil, maxpagesize:nil, filter:nil, custom_headers:nil)
91
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
92
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
93
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
94
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
95
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
96
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
97
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
98
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
99
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
100
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
101
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
102
+
103
+
104
+ request_headers = {}
105
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
106
+
107
+ # Set Headers
108
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
109
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
110
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'
111
+
112
+ request_url = @base_url || @client.base_url
113
+
114
+ options = {
115
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
116
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
117
+ query_params: {'api-version' => @client.api_version,'$skipToken' => skip_token,'$maxpagesize' => maxpagesize,'$filter' => filter},
118
+ headers: request_headers.merge(custom_headers || {}),
119
+ base_url: request_url
120
+ }
121
+ promise = @client.make_request_async(:get, path_template, options)
122
+
123
+ promise = promise.then do |result|
124
+ http_response = result.response
125
+ status_code = http_response.status
126
+ response_content = http_response.body
127
+ unless status_code == 200
128
+ error_model = JSON.load(response_content)
129
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
130
+ end
131
+
132
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
133
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
134
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
135
+ # Deserialize Response
136
+ if status_code == 200
137
+ begin
138
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
139
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileShareItems.mapper()
140
+ result.body = @client.deserialize(result_mapper, parsed_response)
141
+ rescue Exception => e
142
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
143
+ end
144
+ end
145
+
146
+ result
147
+ end
148
+
149
+ promise.execute
150
+ end
151
+
152
+ #
153
+ # Creates a new share under the specified account as described by request body.
154
+ # The share resource includes metadata and properties for that share. It does
155
+ # not include a list of the files contained by the share.
156
+ #
157
+ # @param resource_group_name [String] The name of the resource group within the
158
+ # user's subscription. The name is case insensitive.
159
+ # @param account_name [String] The name of the storage account within the
160
+ # specified resource group. Storage account names must be between 3 and 24
161
+ # characters in length and use numbers and lower-case letters only.
162
+ # @param share_name [String] The name of the file share within the specified
163
+ # storage account. File share names must be between 3 and 63 characters in
164
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
165
+ # character must be immediately preceded and followed by a letter or number.
166
+ # @param file_share [FileShare] Properties of the file share to create.
167
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
168
+ # will be added to the HTTP request.
169
+ #
170
+ # @return [FileShare] operation results.
171
+ #
172
+ def create(resource_group_name, account_name, share_name, file_share, custom_headers:nil)
173
+ response = create_async(resource_group_name, account_name, share_name, file_share, custom_headers:custom_headers).value!
174
+ response.body unless response.nil?
175
+ end
176
+
177
+ #
178
+ # Creates a new share under the specified account as described by request body.
179
+ # The share resource includes metadata and properties for that share. It does
180
+ # not include a list of the files contained by the share.
181
+ #
182
+ # @param resource_group_name [String] The name of the resource group within the
183
+ # user's subscription. The name is case insensitive.
184
+ # @param account_name [String] The name of the storage account within the
185
+ # specified resource group. Storage account names must be between 3 and 24
186
+ # characters in length and use numbers and lower-case letters only.
187
+ # @param share_name [String] The name of the file share within the specified
188
+ # storage account. File share names must be between 3 and 63 characters in
189
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
190
+ # character must be immediately preceded and followed by a letter or number.
191
+ # @param file_share [FileShare] Properties of the file share to create.
192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
193
+ # will be added to the HTTP request.
194
+ #
195
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
196
+ #
197
+ def create_with_http_info(resource_group_name, account_name, share_name, file_share, custom_headers:nil)
198
+ create_async(resource_group_name, account_name, share_name, file_share, custom_headers:custom_headers).value!
199
+ end
200
+
201
+ #
202
+ # Creates a new share under the specified account as described by request body.
203
+ # The share resource includes metadata and properties for that share. It does
204
+ # not include a list of the files contained by the share.
205
+ #
206
+ # @param resource_group_name [String] The name of the resource group within the
207
+ # user's subscription. The name is case insensitive.
208
+ # @param account_name [String] The name of the storage account within the
209
+ # specified resource group. Storage account names must be between 3 and 24
210
+ # characters in length and use numbers and lower-case letters only.
211
+ # @param share_name [String] The name of the file share within the specified
212
+ # storage account. File share names must be between 3 and 63 characters in
213
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
214
+ # character must be immediately preceded and followed by a letter or number.
215
+ # @param file_share [FileShare] Properties of the file share to create.
216
+ # @param [Hash{String => String}] A hash of custom headers that will be added
217
+ # to the HTTP request.
218
+ #
219
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
220
+ #
221
+ def create_async(resource_group_name, account_name, share_name, file_share, custom_headers:nil)
222
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
223
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
224
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
225
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
226
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
227
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
228
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
229
+ fail ArgumentError, 'share_name is nil' if share_name.nil?
230
+ fail ArgumentError, "'share_name' should satisfy the constraint - 'MaxLength': '63'" if !share_name.nil? && share_name.length > 63
231
+ fail ArgumentError, "'share_name' should satisfy the constraint - 'MinLength': '3'" if !share_name.nil? && share_name.length < 3
232
+ fail ArgumentError, 'file_share is nil' if file_share.nil?
233
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
234
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
235
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
236
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
237
+
238
+
239
+ request_headers = {}
240
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
241
+
242
+ # Set Headers
243
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
244
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
245
+
246
+ # Serialize Request
247
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileShare.mapper()
248
+ request_content = @client.serialize(request_mapper, file_share)
249
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
250
+
251
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'
252
+
253
+ request_url = @base_url || @client.base_url
254
+
255
+ options = {
256
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
257
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'shareName' => share_name,'subscriptionId' => @client.subscription_id},
258
+ query_params: {'api-version' => @client.api_version},
259
+ body: request_content,
260
+ headers: request_headers.merge(custom_headers || {}),
261
+ base_url: request_url
262
+ }
263
+ promise = @client.make_request_async(:put, path_template, options)
264
+
265
+ promise = promise.then do |result|
266
+ http_response = result.response
267
+ status_code = http_response.status
268
+ response_content = http_response.body
269
+ unless status_code == 201 || status_code == 200
270
+ error_model = JSON.load(response_content)
271
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
272
+ end
273
+
274
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
275
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
276
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
277
+ # Deserialize Response
278
+ if status_code == 201
279
+ begin
280
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
281
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileShare.mapper()
282
+ result.body = @client.deserialize(result_mapper, parsed_response)
283
+ rescue Exception => e
284
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
285
+ end
286
+ end
287
+ # Deserialize Response
288
+ if status_code == 200
289
+ begin
290
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
291
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileShare.mapper()
292
+ result.body = @client.deserialize(result_mapper, parsed_response)
293
+ rescue Exception => e
294
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
295
+ end
296
+ end
297
+
298
+ result
299
+ end
300
+
301
+ promise.execute
302
+ end
303
+
304
+ #
305
+ # Updates share properties as specified in request body. Properties not
306
+ # mentioned in the request will not be changed. Update fails if the specified
307
+ # share does not already exist.
308
+ #
309
+ # @param resource_group_name [String] The name of the resource group within the
310
+ # user's subscription. The name is case insensitive.
311
+ # @param account_name [String] The name of the storage account within the
312
+ # specified resource group. Storage account names must be between 3 and 24
313
+ # characters in length and use numbers and lower-case letters only.
314
+ # @param share_name [String] The name of the file share within the specified
315
+ # storage account. File share names must be between 3 and 63 characters in
316
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
317
+ # character must be immediately preceded and followed by a letter or number.
318
+ # @param file_share [FileShare] Properties to update for the file share.
319
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
320
+ # will be added to the HTTP request.
321
+ #
322
+ # @return [FileShare] operation results.
323
+ #
324
+ def update(resource_group_name, account_name, share_name, file_share, custom_headers:nil)
325
+ response = update_async(resource_group_name, account_name, share_name, file_share, custom_headers:custom_headers).value!
326
+ response.body unless response.nil?
327
+ end
328
+
329
+ #
330
+ # Updates share properties as specified in request body. Properties not
331
+ # mentioned in the request will not be changed. Update fails if the specified
332
+ # share does not already exist.
333
+ #
334
+ # @param resource_group_name [String] The name of the resource group within the
335
+ # user's subscription. The name is case insensitive.
336
+ # @param account_name [String] The name of the storage account within the
337
+ # specified resource group. Storage account names must be between 3 and 24
338
+ # characters in length and use numbers and lower-case letters only.
339
+ # @param share_name [String] The name of the file share within the specified
340
+ # storage account. File share names must be between 3 and 63 characters in
341
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
342
+ # character must be immediately preceded and followed by a letter or number.
343
+ # @param file_share [FileShare] Properties to update for the file share.
344
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
345
+ # will be added to the HTTP request.
346
+ #
347
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
348
+ #
349
+ def update_with_http_info(resource_group_name, account_name, share_name, file_share, custom_headers:nil)
350
+ update_async(resource_group_name, account_name, share_name, file_share, custom_headers:custom_headers).value!
351
+ end
352
+
353
+ #
354
+ # Updates share properties as specified in request body. Properties not
355
+ # mentioned in the request will not be changed. Update fails if the specified
356
+ # share does not already exist.
357
+ #
358
+ # @param resource_group_name [String] The name of the resource group within the
359
+ # user's subscription. The name is case insensitive.
360
+ # @param account_name [String] The name of the storage account within the
361
+ # specified resource group. Storage account names must be between 3 and 24
362
+ # characters in length and use numbers and lower-case letters only.
363
+ # @param share_name [String] The name of the file share within the specified
364
+ # storage account. File share names must be between 3 and 63 characters in
365
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
366
+ # character must be immediately preceded and followed by a letter or number.
367
+ # @param file_share [FileShare] Properties to update for the file share.
368
+ # @param [Hash{String => String}] A hash of custom headers that will be added
369
+ # to the HTTP request.
370
+ #
371
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
372
+ #
373
+ def update_async(resource_group_name, account_name, share_name, file_share, custom_headers:nil)
374
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
375
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
376
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
377
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
378
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
379
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
380
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
381
+ fail ArgumentError, 'share_name is nil' if share_name.nil?
382
+ fail ArgumentError, "'share_name' should satisfy the constraint - 'MaxLength': '63'" if !share_name.nil? && share_name.length > 63
383
+ fail ArgumentError, "'share_name' should satisfy the constraint - 'MinLength': '3'" if !share_name.nil? && share_name.length < 3
384
+ fail ArgumentError, 'file_share is nil' if file_share.nil?
385
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
386
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
387
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
388
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
389
+
390
+
391
+ request_headers = {}
392
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
393
+
394
+ # Set Headers
395
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
396
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
397
+
398
+ # Serialize Request
399
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileShare.mapper()
400
+ request_content = @client.serialize(request_mapper, file_share)
401
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
402
+
403
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'
404
+
405
+ request_url = @base_url || @client.base_url
406
+
407
+ options = {
408
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
409
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'shareName' => share_name,'subscriptionId' => @client.subscription_id},
410
+ query_params: {'api-version' => @client.api_version},
411
+ body: request_content,
412
+ headers: request_headers.merge(custom_headers || {}),
413
+ base_url: request_url
414
+ }
415
+ promise = @client.make_request_async(:patch, path_template, options)
416
+
417
+ promise = promise.then do |result|
418
+ http_response = result.response
419
+ status_code = http_response.status
420
+ response_content = http_response.body
421
+ unless status_code == 200
422
+ error_model = JSON.load(response_content)
423
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
424
+ end
425
+
426
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
427
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
428
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
429
+ # Deserialize Response
430
+ if status_code == 200
431
+ begin
432
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
433
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileShare.mapper()
434
+ result.body = @client.deserialize(result_mapper, parsed_response)
435
+ rescue Exception => e
436
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
437
+ end
438
+ end
439
+
440
+ result
441
+ end
442
+
443
+ promise.execute
444
+ end
445
+
446
+ #
447
+ # Gets properties of a specified share.
448
+ #
449
+ # @param resource_group_name [String] The name of the resource group within the
450
+ # user's subscription. The name is case insensitive.
451
+ # @param account_name [String] The name of the storage account within the
452
+ # specified resource group. Storage account names must be between 3 and 24
453
+ # characters in length and use numbers and lower-case letters only.
454
+ # @param share_name [String] The name of the file share within the specified
455
+ # storage account. File share names must be between 3 and 63 characters in
456
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
457
+ # character must be immediately preceded and followed by a letter or number.
458
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
459
+ # will be added to the HTTP request.
460
+ #
461
+ # @return [FileShare] operation results.
462
+ #
463
+ def get(resource_group_name, account_name, share_name, custom_headers:nil)
464
+ response = get_async(resource_group_name, account_name, share_name, custom_headers:custom_headers).value!
465
+ response.body unless response.nil?
466
+ end
467
+
468
+ #
469
+ # Gets properties of a specified share.
470
+ #
471
+ # @param resource_group_name [String] The name of the resource group within the
472
+ # user's subscription. The name is case insensitive.
473
+ # @param account_name [String] The name of the storage account within the
474
+ # specified resource group. Storage account names must be between 3 and 24
475
+ # characters in length and use numbers and lower-case letters only.
476
+ # @param share_name [String] The name of the file share within the specified
477
+ # storage account. File share names must be between 3 and 63 characters in
478
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
479
+ # character must be immediately preceded and followed by a letter or number.
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
484
+ #
485
+ def get_with_http_info(resource_group_name, account_name, share_name, custom_headers:nil)
486
+ get_async(resource_group_name, account_name, share_name, custom_headers:custom_headers).value!
487
+ end
488
+
489
+ #
490
+ # Gets properties of a specified share.
491
+ #
492
+ # @param resource_group_name [String] The name of the resource group within the
493
+ # user's subscription. The name is case insensitive.
494
+ # @param account_name [String] The name of the storage account within the
495
+ # specified resource group. Storage account names must be between 3 and 24
496
+ # characters in length and use numbers and lower-case letters only.
497
+ # @param share_name [String] The name of the file share within the specified
498
+ # storage account. File share names must be between 3 and 63 characters in
499
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
500
+ # character must be immediately preceded and followed by a letter or number.
501
+ # @param [Hash{String => String}] A hash of custom headers that will be added
502
+ # to the HTTP request.
503
+ #
504
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
505
+ #
506
+ def get_async(resource_group_name, account_name, share_name, custom_headers:nil)
507
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
508
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
509
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
510
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
511
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
512
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
513
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
514
+ fail ArgumentError, 'share_name is nil' if share_name.nil?
515
+ fail ArgumentError, "'share_name' should satisfy the constraint - 'MaxLength': '63'" if !share_name.nil? && share_name.length > 63
516
+ fail ArgumentError, "'share_name' should satisfy the constraint - 'MinLength': '3'" if !share_name.nil? && share_name.length < 3
517
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
518
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
519
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
520
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
521
+
522
+
523
+ request_headers = {}
524
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
525
+
526
+ # Set Headers
527
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
528
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
529
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'
530
+
531
+ request_url = @base_url || @client.base_url
532
+
533
+ options = {
534
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
535
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'shareName' => share_name,'subscriptionId' => @client.subscription_id},
536
+ query_params: {'api-version' => @client.api_version},
537
+ headers: request_headers.merge(custom_headers || {}),
538
+ base_url: request_url
539
+ }
540
+ promise = @client.make_request_async(:get, path_template, options)
541
+
542
+ promise = promise.then do |result|
543
+ http_response = result.response
544
+ status_code = http_response.status
545
+ response_content = http_response.body
546
+ unless status_code == 200
547
+ error_model = JSON.load(response_content)
548
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
549
+ end
550
+
551
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
552
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
553
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
554
+ # Deserialize Response
555
+ if status_code == 200
556
+ begin
557
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
558
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileShare.mapper()
559
+ result.body = @client.deserialize(result_mapper, parsed_response)
560
+ rescue Exception => e
561
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
562
+ end
563
+ end
564
+
565
+ result
566
+ end
567
+
568
+ promise.execute
569
+ end
570
+
571
+ #
572
+ # Deletes specified share under its account.
573
+ #
574
+ # @param resource_group_name [String] The name of the resource group within the
575
+ # user's subscription. The name is case insensitive.
576
+ # @param account_name [String] The name of the storage account within the
577
+ # specified resource group. Storage account names must be between 3 and 24
578
+ # characters in length and use numbers and lower-case letters only.
579
+ # @param share_name [String] The name of the file share within the specified
580
+ # storage account. File share names must be between 3 and 63 characters in
581
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
582
+ # character must be immediately preceded and followed by a letter or number.
583
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
584
+ # will be added to the HTTP request.
585
+ #
586
+ #
587
+ def delete(resource_group_name, account_name, share_name, custom_headers:nil)
588
+ response = delete_async(resource_group_name, account_name, share_name, custom_headers:custom_headers).value!
589
+ nil
590
+ end
591
+
592
+ #
593
+ # Deletes specified share under its account.
594
+ #
595
+ # @param resource_group_name [String] The name of the resource group within the
596
+ # user's subscription. The name is case insensitive.
597
+ # @param account_name [String] The name of the storage account within the
598
+ # specified resource group. Storage account names must be between 3 and 24
599
+ # characters in length and use numbers and lower-case letters only.
600
+ # @param share_name [String] The name of the file share within the specified
601
+ # storage account. File share names must be between 3 and 63 characters in
602
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
603
+ # character must be immediately preceded and followed by a letter or number.
604
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
605
+ # will be added to the HTTP request.
606
+ #
607
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
608
+ #
609
+ def delete_with_http_info(resource_group_name, account_name, share_name, custom_headers:nil)
610
+ delete_async(resource_group_name, account_name, share_name, custom_headers:custom_headers).value!
611
+ end
612
+
613
+ #
614
+ # Deletes specified share under its account.
615
+ #
616
+ # @param resource_group_name [String] The name of the resource group within the
617
+ # user's subscription. The name is case insensitive.
618
+ # @param account_name [String] The name of the storage account within the
619
+ # specified resource group. Storage account names must be between 3 and 24
620
+ # characters in length and use numbers and lower-case letters only.
621
+ # @param share_name [String] The name of the file share within the specified
622
+ # storage account. File share names must be between 3 and 63 characters in
623
+ # length and use numbers, lower-case letters and dash (-) only. Every dash (-)
624
+ # character must be immediately preceded and followed by a letter or number.
625
+ # @param [Hash{String => String}] A hash of custom headers that will be added
626
+ # to the HTTP request.
627
+ #
628
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
629
+ #
630
+ def delete_async(resource_group_name, account_name, share_name, custom_headers:nil)
631
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
632
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
633
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
634
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
635
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
636
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
637
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
638
+ fail ArgumentError, 'share_name is nil' if share_name.nil?
639
+ fail ArgumentError, "'share_name' should satisfy the constraint - 'MaxLength': '63'" if !share_name.nil? && share_name.length > 63
640
+ fail ArgumentError, "'share_name' should satisfy the constraint - 'MinLength': '3'" if !share_name.nil? && share_name.length < 3
641
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
642
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
643
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
644
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
645
+
646
+
647
+ request_headers = {}
648
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
649
+
650
+ # Set Headers
651
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
652
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
653
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'
654
+
655
+ request_url = @base_url || @client.base_url
656
+
657
+ options = {
658
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
659
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'shareName' => share_name,'subscriptionId' => @client.subscription_id},
660
+ query_params: {'api-version' => @client.api_version},
661
+ headers: request_headers.merge(custom_headers || {}),
662
+ base_url: request_url
663
+ }
664
+ promise = @client.make_request_async(:delete, path_template, options)
665
+
666
+ promise = promise.then do |result|
667
+ http_response = result.response
668
+ status_code = http_response.status
669
+ response_content = http_response.body
670
+ unless status_code == 200 || status_code == 204
671
+ error_model = JSON.load(response_content)
672
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
673
+ end
674
+
675
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
676
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
677
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
678
+
679
+ result
680
+ end
681
+
682
+ promise.execute
683
+ end
684
+
685
+ #
686
+ # Lists all shares.
687
+ #
688
+ # @param next_page_link [String] The NextLink from the previous successful call
689
+ # to List operation.
690
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
691
+ # will be added to the HTTP request.
692
+ #
693
+ # @return [FileShareItems] operation results.
694
+ #
695
+ def list_next(next_page_link, custom_headers:nil)
696
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
697
+ response.body unless response.nil?
698
+ end
699
+
700
+ #
701
+ # Lists all shares.
702
+ #
703
+ # @param next_page_link [String] The NextLink from the previous successful call
704
+ # to List operation.
705
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
706
+ # will be added to the HTTP request.
707
+ #
708
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
709
+ #
710
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
711
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
712
+ end
713
+
714
+ #
715
+ # Lists all shares.
716
+ #
717
+ # @param next_page_link [String] The NextLink from the previous successful call
718
+ # to List operation.
719
+ # @param [Hash{String => String}] A hash of custom headers that will be added
720
+ # to the HTTP request.
721
+ #
722
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
723
+ #
724
+ def list_next_async(next_page_link, custom_headers:nil)
725
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
726
+
727
+
728
+ request_headers = {}
729
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
730
+
731
+ # Set Headers
732
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
733
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
734
+ path_template = '{nextLink}'
735
+
736
+ request_url = @base_url || @client.base_url
737
+
738
+ options = {
739
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
740
+ skip_encoding_path_params: {'nextLink' => next_page_link},
741
+ headers: request_headers.merge(custom_headers || {}),
742
+ base_url: request_url
743
+ }
744
+ promise = @client.make_request_async(:get, path_template, options)
745
+
746
+ promise = promise.then do |result|
747
+ http_response = result.response
748
+ status_code = http_response.status
749
+ response_content = http_response.body
750
+ unless status_code == 200
751
+ error_model = JSON.load(response_content)
752
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
753
+ end
754
+
755
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
756
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
757
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
758
+ # Deserialize Response
759
+ if status_code == 200
760
+ begin
761
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
762
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::FileShareItems.mapper()
763
+ result.body = @client.deserialize(result_mapper, parsed_response)
764
+ rescue Exception => e
765
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
766
+ end
767
+ end
768
+
769
+ result
770
+ end
771
+
772
+ promise.execute
773
+ end
774
+
775
+ #
776
+ # Lists all shares.
777
+ #
778
+ # @param resource_group_name [String] The name of the resource group within the
779
+ # user's subscription. The name is case insensitive.
780
+ # @param account_name [String] The name of the storage account within the
781
+ # specified resource group. Storage account names must be between 3 and 24
782
+ # characters in length and use numbers and lower-case letters only.
783
+ # @param skip_token [String] Optional. Continuation token for the list
784
+ # operation.
785
+ # @param maxpagesize [String] Optional. Specified maximum number of shares that
786
+ # can be included in the list.
787
+ # @param filter [String] Optional. When specified, only share names starting
788
+ # with the filter will be listed.
789
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
790
+ # will be added to the HTTP request.
791
+ #
792
+ # @return [FileShareItems] which provide lazy access to pages of the response.
793
+ #
794
+ def list_as_lazy(resource_group_name, account_name, skip_token:nil, maxpagesize:nil, filter:nil, custom_headers:nil)
795
+ response = list_async(resource_group_name, account_name, skip_token:skip_token, maxpagesize:maxpagesize, filter:filter, custom_headers:custom_headers).value!
796
+ unless response.nil?
797
+ page = response.body
798
+ page.next_method = Proc.new do |next_page_link|
799
+ list_next_async(next_page_link, custom_headers:custom_headers)
800
+ end
801
+ page
802
+ end
803
+ end
804
+
805
+ end
806
+ end