azure_mgmt_redis 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-08-01/generated/azure_mgmt_redis/redis.rb +66 -62
  3. data/lib/2015-08-01/generated/azure_mgmt_redis/redis_management_client.rb +4 -1
  4. data/lib/2016-04-01/generated/azure_mgmt_redis/firewall_rules.rb +15 -13
  5. data/lib/2016-04-01/generated/azure_mgmt_redis/models/redis_update_parameters.rb +1 -1
  6. data/lib/2016-04-01/generated/azure_mgmt_redis/operations.rb +15 -13
  7. data/lib/2016-04-01/generated/azure_mgmt_redis/patch_schedules.rb +18 -17
  8. data/lib/2016-04-01/generated/azure_mgmt_redis/redis.rb +100 -99
  9. data/lib/2016-04-01/generated/azure_mgmt_redis/redis_firewall_rule_operations.rb +18 -17
  10. data/lib/2016-04-01/generated/azure_mgmt_redis/redis_management_client.rb +4 -1
  11. data/lib/2017-02-01/generated/azure_mgmt_redis/firewall_rules.rb +33 -30
  12. data/lib/2017-02-01/generated/azure_mgmt_redis/models/redis_update_parameters.rb +1 -1
  13. data/lib/2017-02-01/generated/azure_mgmt_redis/operations.rb +15 -13
  14. data/lib/2017-02-01/generated/azure_mgmt_redis/patch_schedules.rb +18 -17
  15. data/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb +100 -99
  16. data/lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb +28 -26
  17. data/lib/2017-02-01/generated/azure_mgmt_redis/redis_management_client.rb +4 -1
  18. data/lib/2017-10-01/generated/azure_mgmt_redis.rb +64 -0
  19. data/lib/2017-10-01/generated/azure_mgmt_redis/firewall_rules.rb +528 -0
  20. data/lib/2017-10-01/generated/azure_mgmt_redis/linked_server.rb +594 -0
  21. data/lib/2017-10-01/generated/azure_mgmt_redis/models/day_of_week.rb +23 -0
  22. data/lib/2017-10-01/generated/azure_mgmt_redis/models/export_rdbparameters.rb +68 -0
  23. data/lib/2017-10-01/generated/azure_mgmt_redis/models/import_rdbparameters.rb +65 -0
  24. data/lib/2017-10-01/generated/azure_mgmt_redis/models/operation.rb +58 -0
  25. data/lib/2017-10-01/generated/azure_mgmt_redis/models/operation_display.rb +80 -0
  26. data/lib/2017-10-01/generated/azure_mgmt_redis/models/operation_list_result.rb +102 -0
  27. data/lib/2017-10-01/generated/azure_mgmt_redis/models/proxy_resource.rb +63 -0
  28. data/lib/2017-10-01/generated/azure_mgmt_redis/models/reboot_type.rb +17 -0
  29. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_access_keys.rb +61 -0
  30. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_create_parameters.rb +192 -0
  31. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_firewall_rule.rb +85 -0
  32. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_firewall_rule_create_parameters.rb +57 -0
  33. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_firewall_rule_list_result.rb +100 -0
  34. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_force_reboot_response.rb +47 -0
  35. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_key_type.rb +16 -0
  36. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_linked_server.rb +47 -0
  37. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_linked_server_create_parameters.rb +70 -0
  38. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_linked_server_with_properties.rb +110 -0
  39. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_linked_server_with_properties_list.rb +100 -0
  40. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_list_result.rb +99 -0
  41. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_patch_schedule.rb +83 -0
  42. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_reboot_parameters.rb +60 -0
  43. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_regenerate_key_parameters.rb +48 -0
  44. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_resource.rb +309 -0
  45. data/lib/2017-10-01/generated/azure_mgmt_redis/models/redis_update_parameters.rb +130 -0
  46. data/lib/2017-10-01/generated/azure_mgmt_redis/models/replication_role.rb +16 -0
  47. data/lib/2017-10-01/generated/azure_mgmt_redis/models/resource.rb +71 -0
  48. data/lib/2017-10-01/generated/azure_mgmt_redis/models/schedule_entry.rb +72 -0
  49. data/lib/2017-10-01/generated/azure_mgmt_redis/models/sku.rb +73 -0
  50. data/lib/2017-10-01/generated/azure_mgmt_redis/models/sku_family.rb +16 -0
  51. data/lib/2017-10-01/generated/azure_mgmt_redis/models/sku_name.rb +17 -0
  52. data/lib/2017-10-01/generated/azure_mgmt_redis/models/tracked_resource.rb +92 -0
  53. data/lib/2017-10-01/generated/azure_mgmt_redis/module_definition.rb +9 -0
  54. data/lib/2017-10-01/generated/azure_mgmt_redis/operations.rb +222 -0
  55. data/lib/2017-10-01/generated/azure_mgmt_redis/patch_schedules.rb +317 -0
  56. data/lib/2017-10-01/generated/azure_mgmt_redis/redis.rb +1482 -0
  57. data/lib/2017-10-01/generated/azure_mgmt_redis/redis_management_client.rb +148 -0
  58. data/lib/azure_mgmt_redis.rb +1 -0
  59. data/lib/profiles/latest/modules/redis_profile_module.rb +166 -147
  60. data/lib/profiles/latest/redis_latest_profile_client.rb +28 -9
  61. data/lib/profiles/latest/redis_module_definition.rb +0 -1
  62. data/lib/version.rb +1 -1
  63. metadata +43 -3
@@ -0,0 +1,1482 @@
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::Redis::Mgmt::V2017_10_01
7
+ #
8
+ # REST API for Azure Redis Cache Service.
9
+ #
10
+ class Redis
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Redis class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [RedisManagementClient] reference to the RedisManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Create or replace (overwrite/recreate, with potential downtime) an existing
26
+ # Redis cache.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param name [String] The name of the Redis cache.
30
+ # @param parameters [RedisCreateParameters] Parameters supplied to the Create
31
+ # Redis operation.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [RedisResource] operation results.
36
+ #
37
+ def create(resource_group_name, name, parameters, custom_headers:nil)
38
+ response = create_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # @param resource_group_name [String] The name of the resource group.
44
+ # @param name [String] The name of the Redis cache.
45
+ # @param parameters [RedisCreateParameters] Parameters supplied to the Create
46
+ # Redis operation.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [Concurrent::Promise] promise which provides async access to http
51
+ # response.
52
+ #
53
+ def create_async(resource_group_name, name, parameters, custom_headers:nil)
54
+ # Send request
55
+ promise = begin_create_async(resource_group_name, name, parameters, custom_headers:custom_headers)
56
+
57
+ promise = promise.then do |response|
58
+ # Defining deserialization method.
59
+ deserialize_method = lambda do |parsed_response|
60
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisResource.mapper()
61
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
62
+ end
63
+
64
+ # Waiting for response.
65
+ @client.get_long_running_operation_result(response, deserialize_method)
66
+ end
67
+
68
+ promise
69
+ end
70
+
71
+ #
72
+ # Update an existing Redis cache.
73
+ #
74
+ # @param resource_group_name [String] The name of the resource group.
75
+ # @param name [String] The name of the Redis cache.
76
+ # @param parameters [RedisUpdateParameters] Parameters supplied to the Update
77
+ # Redis operation.
78
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
79
+ # will be added to the HTTP request.
80
+ #
81
+ # @return [RedisResource] operation results.
82
+ #
83
+ def update(resource_group_name, name, parameters, custom_headers:nil)
84
+ response = update_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
85
+ response.body unless response.nil?
86
+ end
87
+
88
+ #
89
+ # Update an existing Redis cache.
90
+ #
91
+ # @param resource_group_name [String] The name of the resource group.
92
+ # @param name [String] The name of the Redis cache.
93
+ # @param parameters [RedisUpdateParameters] Parameters supplied to the Update
94
+ # Redis operation.
95
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
96
+ # will be added to the HTTP request.
97
+ #
98
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
99
+ #
100
+ def update_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
101
+ update_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
102
+ end
103
+
104
+ #
105
+ # Update an existing Redis cache.
106
+ #
107
+ # @param resource_group_name [String] The name of the resource group.
108
+ # @param name [String] The name of the Redis cache.
109
+ # @param parameters [RedisUpdateParameters] Parameters supplied to the Update
110
+ # Redis operation.
111
+ # @param [Hash{String => String}] A hash of custom headers that will be added
112
+ # to the HTTP request.
113
+ #
114
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
115
+ #
116
+ def update_async(resource_group_name, name, parameters, custom_headers:nil)
117
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
118
+ fail ArgumentError, 'name is nil' if name.nil?
119
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
120
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
121
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
122
+
123
+
124
+ request_headers = {}
125
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
126
+
127
+ # Set Headers
128
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
129
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
130
+
131
+ # Serialize Request
132
+ request_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisUpdateParameters.mapper()
133
+ request_content = @client.serialize(request_mapper, parameters)
134
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
135
+
136
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
137
+
138
+ request_url = @base_url || @client.base_url
139
+
140
+ options = {
141
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
142
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
143
+ query_params: {'api-version' => @client.api_version},
144
+ body: request_content,
145
+ headers: request_headers.merge(custom_headers || {}),
146
+ base_url: request_url
147
+ }
148
+ promise = @client.make_request_async(:patch, path_template, options)
149
+
150
+ promise = promise.then do |result|
151
+ http_response = result.response
152
+ status_code = http_response.status
153
+ response_content = http_response.body
154
+ unless status_code == 200
155
+ error_model = JSON.load(response_content)
156
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
157
+ end
158
+
159
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
160
+ # Deserialize Response
161
+ if status_code == 200
162
+ begin
163
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
164
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisResource.mapper()
165
+ result.body = @client.deserialize(result_mapper, parsed_response)
166
+ rescue Exception => e
167
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
168
+ end
169
+ end
170
+
171
+ result
172
+ end
173
+
174
+ promise.execute
175
+ end
176
+
177
+ #
178
+ # Deletes a Redis cache.
179
+ #
180
+ # @param resource_group_name [String] The name of the resource group.
181
+ # @param name [String] The name of the Redis cache.
182
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
183
+ # will be added to the HTTP request.
184
+ #
185
+ def delete(resource_group_name, name, custom_headers:nil)
186
+ response = delete_async(resource_group_name, name, custom_headers:custom_headers).value!
187
+ nil
188
+ end
189
+
190
+ #
191
+ # @param resource_group_name [String] The name of the resource group.
192
+ # @param name [String] The name of the Redis cache.
193
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
194
+ # will be added to the HTTP request.
195
+ #
196
+ # @return [Concurrent::Promise] promise which provides async access to http
197
+ # response.
198
+ #
199
+ def delete_async(resource_group_name, name, custom_headers:nil)
200
+ # Send request
201
+ promise = begin_delete_async(resource_group_name, name, custom_headers:custom_headers)
202
+
203
+ promise = promise.then do |response|
204
+ # Defining deserialization method.
205
+ deserialize_method = lambda do |parsed_response|
206
+ end
207
+
208
+ # Waiting for response.
209
+ @client.get_long_running_operation_result(response, deserialize_method)
210
+ end
211
+
212
+ promise
213
+ end
214
+
215
+ #
216
+ # Gets a Redis cache (resource description).
217
+ #
218
+ # @param resource_group_name [String] The name of the resource group.
219
+ # @param name [String] The name of the Redis cache.
220
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
221
+ # will be added to the HTTP request.
222
+ #
223
+ # @return [RedisResource] operation results.
224
+ #
225
+ def get(resource_group_name, name, custom_headers:nil)
226
+ response = get_async(resource_group_name, name, custom_headers:custom_headers).value!
227
+ response.body unless response.nil?
228
+ end
229
+
230
+ #
231
+ # Gets a Redis cache (resource description).
232
+ #
233
+ # @param resource_group_name [String] The name of the resource group.
234
+ # @param name [String] The name of the Redis cache.
235
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
236
+ # will be added to the HTTP request.
237
+ #
238
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
239
+ #
240
+ def get_with_http_info(resource_group_name, name, custom_headers:nil)
241
+ get_async(resource_group_name, name, custom_headers:custom_headers).value!
242
+ end
243
+
244
+ #
245
+ # Gets a Redis cache (resource description).
246
+ #
247
+ # @param resource_group_name [String] The name of the resource group.
248
+ # @param name [String] The name of the Redis cache.
249
+ # @param [Hash{String => String}] A hash of custom headers that will be added
250
+ # to the HTTP request.
251
+ #
252
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
253
+ #
254
+ def get_async(resource_group_name, name, custom_headers:nil)
255
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
256
+ fail ArgumentError, 'name is nil' if name.nil?
257
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
258
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
259
+
260
+
261
+ request_headers = {}
262
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
263
+
264
+ # Set Headers
265
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
266
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
267
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
268
+
269
+ request_url = @base_url || @client.base_url
270
+
271
+ options = {
272
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
273
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
274
+ query_params: {'api-version' => @client.api_version},
275
+ headers: request_headers.merge(custom_headers || {}),
276
+ base_url: request_url
277
+ }
278
+ promise = @client.make_request_async(:get, path_template, options)
279
+
280
+ promise = promise.then do |result|
281
+ http_response = result.response
282
+ status_code = http_response.status
283
+ response_content = http_response.body
284
+ unless status_code == 200
285
+ error_model = JSON.load(response_content)
286
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
287
+ end
288
+
289
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
290
+ # Deserialize Response
291
+ if status_code == 200
292
+ begin
293
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
294
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisResource.mapper()
295
+ result.body = @client.deserialize(result_mapper, parsed_response)
296
+ rescue Exception => e
297
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
298
+ end
299
+ end
300
+
301
+ result
302
+ end
303
+
304
+ promise.execute
305
+ end
306
+
307
+ #
308
+ # Lists all Redis caches in a resource group.
309
+ #
310
+ # @param resource_group_name [String] The name of the resource group.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [Array<RedisResource>] operation results.
315
+ #
316
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
317
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
318
+ first_page.get_all_items
319
+ end
320
+
321
+ #
322
+ # Lists all Redis caches in a resource group.
323
+ #
324
+ # @param resource_group_name [String] The name of the resource group.
325
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
326
+ # will be added to the HTTP request.
327
+ #
328
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
329
+ #
330
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
331
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
332
+ end
333
+
334
+ #
335
+ # Lists all Redis caches in a resource group.
336
+ #
337
+ # @param resource_group_name [String] The name of the resource group.
338
+ # @param [Hash{String => String}] A hash of custom headers that will be added
339
+ # to the HTTP request.
340
+ #
341
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
342
+ #
343
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
344
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
345
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
346
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
347
+
348
+
349
+ request_headers = {}
350
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
351
+
352
+ # Set Headers
353
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
354
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
355
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/'
356
+
357
+ request_url = @base_url || @client.base_url
358
+
359
+ options = {
360
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
361
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
362
+ query_params: {'api-version' => @client.api_version},
363
+ headers: request_headers.merge(custom_headers || {}),
364
+ base_url: request_url
365
+ }
366
+ promise = @client.make_request_async(:get, path_template, options)
367
+
368
+ promise = promise.then do |result|
369
+ http_response = result.response
370
+ status_code = http_response.status
371
+ response_content = http_response.body
372
+ unless status_code == 200
373
+ error_model = JSON.load(response_content)
374
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
375
+ end
376
+
377
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
378
+ # Deserialize Response
379
+ if status_code == 200
380
+ begin
381
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
382
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisListResult.mapper()
383
+ result.body = @client.deserialize(result_mapper, parsed_response)
384
+ rescue Exception => e
385
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
386
+ end
387
+ end
388
+
389
+ result
390
+ end
391
+
392
+ promise.execute
393
+ end
394
+
395
+ #
396
+ # Gets all Redis caches in the specified subscription.
397
+ #
398
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
399
+ # will be added to the HTTP request.
400
+ #
401
+ # @return [Array<RedisResource>] operation results.
402
+ #
403
+ def list(custom_headers:nil)
404
+ first_page = list_as_lazy(custom_headers:custom_headers)
405
+ first_page.get_all_items
406
+ end
407
+
408
+ #
409
+ # Gets all Redis caches in the specified subscription.
410
+ #
411
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
412
+ # will be added to the HTTP request.
413
+ #
414
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
415
+ #
416
+ def list_with_http_info(custom_headers:nil)
417
+ list_async(custom_headers:custom_headers).value!
418
+ end
419
+
420
+ #
421
+ # Gets all Redis caches in the specified subscription.
422
+ #
423
+ # @param [Hash{String => String}] A hash of custom headers that will be added
424
+ # to the HTTP request.
425
+ #
426
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
427
+ #
428
+ def list_async(custom_headers:nil)
429
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
430
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
431
+
432
+
433
+ request_headers = {}
434
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
435
+
436
+ # Set Headers
437
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
438
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
439
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Cache/Redis/'
440
+
441
+ request_url = @base_url || @client.base_url
442
+
443
+ options = {
444
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
445
+ path_params: {'subscriptionId' => @client.subscription_id},
446
+ query_params: {'api-version' => @client.api_version},
447
+ headers: request_headers.merge(custom_headers || {}),
448
+ base_url: request_url
449
+ }
450
+ promise = @client.make_request_async(:get, path_template, options)
451
+
452
+ promise = promise.then do |result|
453
+ http_response = result.response
454
+ status_code = http_response.status
455
+ response_content = http_response.body
456
+ unless status_code == 200
457
+ error_model = JSON.load(response_content)
458
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
459
+ end
460
+
461
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
462
+ # Deserialize Response
463
+ if status_code == 200
464
+ begin
465
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
466
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisListResult.mapper()
467
+ result.body = @client.deserialize(result_mapper, parsed_response)
468
+ rescue Exception => e
469
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
470
+ end
471
+ end
472
+
473
+ result
474
+ end
475
+
476
+ promise.execute
477
+ end
478
+
479
+ #
480
+ # Retrieve a Redis cache's access keys. This operation requires write
481
+ # permission to the cache resource.
482
+ #
483
+ # @param resource_group_name [String] The name of the resource group.
484
+ # @param name [String] The name of the Redis cache.
485
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
486
+ # will be added to the HTTP request.
487
+ #
488
+ # @return [RedisAccessKeys] operation results.
489
+ #
490
+ def list_keys(resource_group_name, name, custom_headers:nil)
491
+ response = list_keys_async(resource_group_name, name, custom_headers:custom_headers).value!
492
+ response.body unless response.nil?
493
+ end
494
+
495
+ #
496
+ # Retrieve a Redis cache's access keys. This operation requires write
497
+ # permission to the cache resource.
498
+ #
499
+ # @param resource_group_name [String] The name of the resource group.
500
+ # @param name [String] The name of the Redis cache.
501
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
502
+ # will be added to the HTTP request.
503
+ #
504
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
505
+ #
506
+ def list_keys_with_http_info(resource_group_name, name, custom_headers:nil)
507
+ list_keys_async(resource_group_name, name, custom_headers:custom_headers).value!
508
+ end
509
+
510
+ #
511
+ # Retrieve a Redis cache's access keys. This operation requires write
512
+ # permission to the cache resource.
513
+ #
514
+ # @param resource_group_name [String] The name of the resource group.
515
+ # @param name [String] The name of the Redis cache.
516
+ # @param [Hash{String => String}] A hash of custom headers that will be added
517
+ # to the HTTP request.
518
+ #
519
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
520
+ #
521
+ def list_keys_async(resource_group_name, name, custom_headers:nil)
522
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
523
+ fail ArgumentError, 'name is nil' if name.nil?
524
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
525
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
526
+
527
+
528
+ request_headers = {}
529
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
530
+
531
+ # Set Headers
532
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
533
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
534
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/listKeys'
535
+
536
+ request_url = @base_url || @client.base_url
537
+
538
+ options = {
539
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
540
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
541
+ query_params: {'api-version' => @client.api_version},
542
+ headers: request_headers.merge(custom_headers || {}),
543
+ base_url: request_url
544
+ }
545
+ promise = @client.make_request_async(:post, path_template, options)
546
+
547
+ promise = promise.then do |result|
548
+ http_response = result.response
549
+ status_code = http_response.status
550
+ response_content = http_response.body
551
+ unless status_code == 200
552
+ error_model = JSON.load(response_content)
553
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
554
+ end
555
+
556
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
557
+ # Deserialize Response
558
+ if status_code == 200
559
+ begin
560
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
561
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisAccessKeys.mapper()
562
+ result.body = @client.deserialize(result_mapper, parsed_response)
563
+ rescue Exception => e
564
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
565
+ end
566
+ end
567
+
568
+ result
569
+ end
570
+
571
+ promise.execute
572
+ end
573
+
574
+ #
575
+ # Regenerate Redis cache's access keys. This operation requires write
576
+ # permission to the cache resource.
577
+ #
578
+ # @param resource_group_name [String] The name of the resource group.
579
+ # @param name [String] The name of the Redis cache.
580
+ # @param parameters [RedisRegenerateKeyParameters] Specifies which key to
581
+ # regenerate.
582
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
583
+ # will be added to the HTTP request.
584
+ #
585
+ # @return [RedisAccessKeys] operation results.
586
+ #
587
+ def regenerate_key(resource_group_name, name, parameters, custom_headers:nil)
588
+ response = regenerate_key_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
589
+ response.body unless response.nil?
590
+ end
591
+
592
+ #
593
+ # Regenerate Redis cache's access keys. This operation requires write
594
+ # permission to the cache resource.
595
+ #
596
+ # @param resource_group_name [String] The name of the resource group.
597
+ # @param name [String] The name of the Redis cache.
598
+ # @param parameters [RedisRegenerateKeyParameters] Specifies which key to
599
+ # regenerate.
600
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
601
+ # will be added to the HTTP request.
602
+ #
603
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
604
+ #
605
+ def regenerate_key_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
606
+ regenerate_key_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
607
+ end
608
+
609
+ #
610
+ # Regenerate Redis cache's access keys. This operation requires write
611
+ # permission to the cache resource.
612
+ #
613
+ # @param resource_group_name [String] The name of the resource group.
614
+ # @param name [String] The name of the Redis cache.
615
+ # @param parameters [RedisRegenerateKeyParameters] Specifies which key to
616
+ # regenerate.
617
+ # @param [Hash{String => String}] A hash of custom headers that will be added
618
+ # to the HTTP request.
619
+ #
620
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
621
+ #
622
+ def regenerate_key_async(resource_group_name, name, parameters, custom_headers:nil)
623
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
624
+ fail ArgumentError, 'name is nil' if name.nil?
625
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
626
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
627
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
628
+
629
+
630
+ request_headers = {}
631
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
632
+
633
+ # Set Headers
634
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
635
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
636
+
637
+ # Serialize Request
638
+ request_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisRegenerateKeyParameters.mapper()
639
+ request_content = @client.serialize(request_mapper, parameters)
640
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
641
+
642
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey'
643
+
644
+ request_url = @base_url || @client.base_url
645
+
646
+ options = {
647
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
648
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
649
+ query_params: {'api-version' => @client.api_version},
650
+ body: request_content,
651
+ headers: request_headers.merge(custom_headers || {}),
652
+ base_url: request_url
653
+ }
654
+ promise = @client.make_request_async(:post, path_template, options)
655
+
656
+ promise = promise.then do |result|
657
+ http_response = result.response
658
+ status_code = http_response.status
659
+ response_content = http_response.body
660
+ unless status_code == 200
661
+ error_model = JSON.load(response_content)
662
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
663
+ end
664
+
665
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
666
+ # Deserialize Response
667
+ if status_code == 200
668
+ begin
669
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
670
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisAccessKeys.mapper()
671
+ result.body = @client.deserialize(result_mapper, parsed_response)
672
+ rescue Exception => e
673
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
674
+ end
675
+ end
676
+
677
+ result
678
+ end
679
+
680
+ promise.execute
681
+ end
682
+
683
+ #
684
+ # Reboot specified Redis node(s). This operation requires write permission to
685
+ # the cache resource. There can be potential data loss.
686
+ #
687
+ # @param resource_group_name [String] The name of the resource group.
688
+ # @param name [String] The name of the Redis cache.
689
+ # @param parameters [RedisRebootParameters] Specifies which Redis node(s) to
690
+ # reboot.
691
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
692
+ # will be added to the HTTP request.
693
+ #
694
+ # @return [RedisForceRebootResponse] operation results.
695
+ #
696
+ def force_reboot(resource_group_name, name, parameters, custom_headers:nil)
697
+ response = force_reboot_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
698
+ response.body unless response.nil?
699
+ end
700
+
701
+ #
702
+ # Reboot specified Redis node(s). This operation requires write permission to
703
+ # the cache resource. There can be potential data loss.
704
+ #
705
+ # @param resource_group_name [String] The name of the resource group.
706
+ # @param name [String] The name of the Redis cache.
707
+ # @param parameters [RedisRebootParameters] Specifies which Redis node(s) to
708
+ # reboot.
709
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
710
+ # will be added to the HTTP request.
711
+ #
712
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
713
+ #
714
+ def force_reboot_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
715
+ force_reboot_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
716
+ end
717
+
718
+ #
719
+ # Reboot specified Redis node(s). This operation requires write permission to
720
+ # the cache resource. There can be potential data loss.
721
+ #
722
+ # @param resource_group_name [String] The name of the resource group.
723
+ # @param name [String] The name of the Redis cache.
724
+ # @param parameters [RedisRebootParameters] Specifies which Redis node(s) to
725
+ # reboot.
726
+ # @param [Hash{String => String}] A hash of custom headers that will be added
727
+ # to the HTTP request.
728
+ #
729
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
730
+ #
731
+ def force_reboot_async(resource_group_name, name, parameters, custom_headers:nil)
732
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
733
+ fail ArgumentError, 'name is nil' if name.nil?
734
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
735
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
736
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
737
+
738
+
739
+ request_headers = {}
740
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
741
+
742
+ # Set Headers
743
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
744
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
745
+
746
+ # Serialize Request
747
+ request_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisRebootParameters.mapper()
748
+ request_content = @client.serialize(request_mapper, parameters)
749
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
750
+
751
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot'
752
+
753
+ request_url = @base_url || @client.base_url
754
+
755
+ options = {
756
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
757
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
758
+ query_params: {'api-version' => @client.api_version},
759
+ body: request_content,
760
+ headers: request_headers.merge(custom_headers || {}),
761
+ base_url: request_url
762
+ }
763
+ promise = @client.make_request_async(:post, path_template, options)
764
+
765
+ promise = promise.then do |result|
766
+ http_response = result.response
767
+ status_code = http_response.status
768
+ response_content = http_response.body
769
+ unless status_code == 200
770
+ error_model = JSON.load(response_content)
771
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
772
+ end
773
+
774
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
775
+ # Deserialize Response
776
+ if status_code == 200
777
+ begin
778
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
779
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisForceRebootResponse.mapper()
780
+ result.body = @client.deserialize(result_mapper, parsed_response)
781
+ rescue Exception => e
782
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
783
+ end
784
+ end
785
+
786
+ result
787
+ end
788
+
789
+ promise.execute
790
+ end
791
+
792
+ #
793
+ # Import data into Redis cache.
794
+ #
795
+ # @param resource_group_name [String] The name of the resource group.
796
+ # @param name [String] The name of the Redis cache.
797
+ # @param parameters [ImportRDBParameters] Parameters for Redis import
798
+ # operation.
799
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
800
+ # will be added to the HTTP request.
801
+ #
802
+ def import_data(resource_group_name, name, parameters, custom_headers:nil)
803
+ response = import_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
804
+ nil
805
+ end
806
+
807
+ #
808
+ # @param resource_group_name [String] The name of the resource group.
809
+ # @param name [String] The name of the Redis cache.
810
+ # @param parameters [ImportRDBParameters] Parameters for Redis import
811
+ # operation.
812
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
813
+ # will be added to the HTTP request.
814
+ #
815
+ # @return [Concurrent::Promise] promise which provides async access to http
816
+ # response.
817
+ #
818
+ def import_data_async(resource_group_name, name, parameters, custom_headers:nil)
819
+ # Send request
820
+ promise = begin_import_data_async(resource_group_name, name, parameters, custom_headers:custom_headers)
821
+
822
+ promise = promise.then do |response|
823
+ # Defining deserialization method.
824
+ deserialize_method = lambda do |parsed_response|
825
+ end
826
+
827
+ # Waiting for response.
828
+ @client.get_long_running_operation_result(response, deserialize_method)
829
+ end
830
+
831
+ promise
832
+ end
833
+
834
+ #
835
+ # Export data from the redis cache to blobs in a container.
836
+ #
837
+ # @param resource_group_name [String] The name of the resource group.
838
+ # @param name [String] The name of the Redis cache.
839
+ # @param parameters [ExportRDBParameters] Parameters for Redis export
840
+ # operation.
841
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
842
+ # will be added to the HTTP request.
843
+ #
844
+ def export_data(resource_group_name, name, parameters, custom_headers:nil)
845
+ response = export_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
846
+ nil
847
+ end
848
+
849
+ #
850
+ # @param resource_group_name [String] The name of the resource group.
851
+ # @param name [String] The name of the Redis cache.
852
+ # @param parameters [ExportRDBParameters] Parameters for Redis export
853
+ # operation.
854
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
855
+ # will be added to the HTTP request.
856
+ #
857
+ # @return [Concurrent::Promise] promise which provides async access to http
858
+ # response.
859
+ #
860
+ def export_data_async(resource_group_name, name, parameters, custom_headers:nil)
861
+ # Send request
862
+ promise = begin_export_data_async(resource_group_name, name, parameters, custom_headers:custom_headers)
863
+
864
+ promise = promise.then do |response|
865
+ # Defining deserialization method.
866
+ deserialize_method = lambda do |parsed_response|
867
+ end
868
+
869
+ # Waiting for response.
870
+ @client.get_long_running_operation_result(response, deserialize_method)
871
+ end
872
+
873
+ promise
874
+ end
875
+
876
+ #
877
+ # Create or replace (overwrite/recreate, with potential downtime) an existing
878
+ # Redis cache.
879
+ #
880
+ # @param resource_group_name [String] The name of the resource group.
881
+ # @param name [String] The name of the Redis cache.
882
+ # @param parameters [RedisCreateParameters] Parameters supplied to the Create
883
+ # Redis operation.
884
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
885
+ # will be added to the HTTP request.
886
+ #
887
+ # @return [RedisResource] operation results.
888
+ #
889
+ def begin_create(resource_group_name, name, parameters, custom_headers:nil)
890
+ response = begin_create_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
891
+ response.body unless response.nil?
892
+ end
893
+
894
+ #
895
+ # Create or replace (overwrite/recreate, with potential downtime) an existing
896
+ # Redis cache.
897
+ #
898
+ # @param resource_group_name [String] The name of the resource group.
899
+ # @param name [String] The name of the Redis cache.
900
+ # @param parameters [RedisCreateParameters] Parameters supplied to the Create
901
+ # Redis operation.
902
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
903
+ # will be added to the HTTP request.
904
+ #
905
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
906
+ #
907
+ def begin_create_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
908
+ begin_create_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
909
+ end
910
+
911
+ #
912
+ # Create or replace (overwrite/recreate, with potential downtime) an existing
913
+ # Redis cache.
914
+ #
915
+ # @param resource_group_name [String] The name of the resource group.
916
+ # @param name [String] The name of the Redis cache.
917
+ # @param parameters [RedisCreateParameters] Parameters supplied to the Create
918
+ # Redis operation.
919
+ # @param [Hash{String => String}] A hash of custom headers that will be added
920
+ # to the HTTP request.
921
+ #
922
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
923
+ #
924
+ def begin_create_async(resource_group_name, name, parameters, custom_headers:nil)
925
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
926
+ fail ArgumentError, 'name is nil' if name.nil?
927
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
928
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
929
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
930
+
931
+
932
+ request_headers = {}
933
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
934
+
935
+ # Set Headers
936
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
937
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
938
+
939
+ # Serialize Request
940
+ request_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisCreateParameters.mapper()
941
+ request_content = @client.serialize(request_mapper, parameters)
942
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
943
+
944
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
945
+
946
+ request_url = @base_url || @client.base_url
947
+
948
+ options = {
949
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
950
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
951
+ query_params: {'api-version' => @client.api_version},
952
+ body: request_content,
953
+ headers: request_headers.merge(custom_headers || {}),
954
+ base_url: request_url
955
+ }
956
+ promise = @client.make_request_async(:put, path_template, options)
957
+
958
+ promise = promise.then do |result|
959
+ http_response = result.response
960
+ status_code = http_response.status
961
+ response_content = http_response.body
962
+ unless status_code == 201 || status_code == 200
963
+ error_model = JSON.load(response_content)
964
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
965
+ end
966
+
967
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
968
+ # Deserialize Response
969
+ if status_code == 201
970
+ begin
971
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
972
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisResource.mapper()
973
+ result.body = @client.deserialize(result_mapper, parsed_response)
974
+ rescue Exception => e
975
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
976
+ end
977
+ end
978
+ # Deserialize Response
979
+ if status_code == 200
980
+ begin
981
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
982
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisResource.mapper()
983
+ result.body = @client.deserialize(result_mapper, parsed_response)
984
+ rescue Exception => e
985
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
986
+ end
987
+ end
988
+
989
+ result
990
+ end
991
+
992
+ promise.execute
993
+ end
994
+
995
+ #
996
+ # Deletes a Redis cache.
997
+ #
998
+ # @param resource_group_name [String] The name of the resource group.
999
+ # @param name [String] The name of the Redis cache.
1000
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1001
+ # will be added to the HTTP request.
1002
+ #
1003
+ #
1004
+ def begin_delete(resource_group_name, name, custom_headers:nil)
1005
+ response = begin_delete_async(resource_group_name, name, custom_headers:custom_headers).value!
1006
+ nil
1007
+ end
1008
+
1009
+ #
1010
+ # Deletes a Redis cache.
1011
+ #
1012
+ # @param resource_group_name [String] The name of the resource group.
1013
+ # @param name [String] The name of the Redis cache.
1014
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1015
+ # will be added to the HTTP request.
1016
+ #
1017
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1018
+ #
1019
+ def begin_delete_with_http_info(resource_group_name, name, custom_headers:nil)
1020
+ begin_delete_async(resource_group_name, name, custom_headers:custom_headers).value!
1021
+ end
1022
+
1023
+ #
1024
+ # Deletes a Redis cache.
1025
+ #
1026
+ # @param resource_group_name [String] The name of the resource group.
1027
+ # @param name [String] The name of the Redis cache.
1028
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1029
+ # to the HTTP request.
1030
+ #
1031
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1032
+ #
1033
+ def begin_delete_async(resource_group_name, name, custom_headers:nil)
1034
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1035
+ fail ArgumentError, 'name is nil' if name.nil?
1036
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1037
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1038
+
1039
+
1040
+ request_headers = {}
1041
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1042
+
1043
+ # Set Headers
1044
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1045
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1046
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
1047
+
1048
+ request_url = @base_url || @client.base_url
1049
+
1050
+ options = {
1051
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1052
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
1053
+ query_params: {'api-version' => @client.api_version},
1054
+ headers: request_headers.merge(custom_headers || {}),
1055
+ base_url: request_url
1056
+ }
1057
+ promise = @client.make_request_async(:delete, path_template, options)
1058
+
1059
+ promise = promise.then do |result|
1060
+ http_response = result.response
1061
+ status_code = http_response.status
1062
+ response_content = http_response.body
1063
+ unless status_code == 200 || status_code == 204
1064
+ error_model = JSON.load(response_content)
1065
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1066
+ end
1067
+
1068
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1069
+
1070
+ result
1071
+ end
1072
+
1073
+ promise.execute
1074
+ end
1075
+
1076
+ #
1077
+ # Import data into Redis cache.
1078
+ #
1079
+ # @param resource_group_name [String] The name of the resource group.
1080
+ # @param name [String] The name of the Redis cache.
1081
+ # @param parameters [ImportRDBParameters] Parameters for Redis import
1082
+ # operation.
1083
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1084
+ # will be added to the HTTP request.
1085
+ #
1086
+ #
1087
+ def begin_import_data(resource_group_name, name, parameters, custom_headers:nil)
1088
+ response = begin_import_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
1089
+ nil
1090
+ end
1091
+
1092
+ #
1093
+ # Import data into Redis cache.
1094
+ #
1095
+ # @param resource_group_name [String] The name of the resource group.
1096
+ # @param name [String] The name of the Redis cache.
1097
+ # @param parameters [ImportRDBParameters] Parameters for Redis import
1098
+ # operation.
1099
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1100
+ # will be added to the HTTP request.
1101
+ #
1102
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1103
+ #
1104
+ def begin_import_data_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
1105
+ begin_import_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
1106
+ end
1107
+
1108
+ #
1109
+ # Import data into Redis cache.
1110
+ #
1111
+ # @param resource_group_name [String] The name of the resource group.
1112
+ # @param name [String] The name of the Redis cache.
1113
+ # @param parameters [ImportRDBParameters] Parameters for Redis import
1114
+ # operation.
1115
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1116
+ # to the HTTP request.
1117
+ #
1118
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1119
+ #
1120
+ def begin_import_data_async(resource_group_name, name, parameters, custom_headers:nil)
1121
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1122
+ fail ArgumentError, 'name is nil' if name.nil?
1123
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1124
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1125
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1126
+
1127
+
1128
+ request_headers = {}
1129
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1130
+
1131
+ # Set Headers
1132
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1133
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1134
+
1135
+ # Serialize Request
1136
+ request_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::ImportRDBParameters.mapper()
1137
+ request_content = @client.serialize(request_mapper, parameters)
1138
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1139
+
1140
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import'
1141
+
1142
+ request_url = @base_url || @client.base_url
1143
+
1144
+ options = {
1145
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1146
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
1147
+ query_params: {'api-version' => @client.api_version},
1148
+ body: request_content,
1149
+ headers: request_headers.merge(custom_headers || {}),
1150
+ base_url: request_url
1151
+ }
1152
+ promise = @client.make_request_async(:post, path_template, options)
1153
+
1154
+ promise = promise.then do |result|
1155
+ http_response = result.response
1156
+ status_code = http_response.status
1157
+ response_content = http_response.body
1158
+ unless status_code == 202 || status_code == 200 || status_code == 204
1159
+ error_model = JSON.load(response_content)
1160
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1161
+ end
1162
+
1163
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1164
+
1165
+ result
1166
+ end
1167
+
1168
+ promise.execute
1169
+ end
1170
+
1171
+ #
1172
+ # Export data from the redis cache to blobs in a container.
1173
+ #
1174
+ # @param resource_group_name [String] The name of the resource group.
1175
+ # @param name [String] The name of the Redis cache.
1176
+ # @param parameters [ExportRDBParameters] Parameters for Redis export
1177
+ # operation.
1178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1179
+ # will be added to the HTTP request.
1180
+ #
1181
+ #
1182
+ def begin_export_data(resource_group_name, name, parameters, custom_headers:nil)
1183
+ response = begin_export_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
1184
+ nil
1185
+ end
1186
+
1187
+ #
1188
+ # Export data from the redis cache to blobs in a container.
1189
+ #
1190
+ # @param resource_group_name [String] The name of the resource group.
1191
+ # @param name [String] The name of the Redis cache.
1192
+ # @param parameters [ExportRDBParameters] Parameters for Redis export
1193
+ # operation.
1194
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1195
+ # will be added to the HTTP request.
1196
+ #
1197
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1198
+ #
1199
+ def begin_export_data_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
1200
+ begin_export_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
1201
+ end
1202
+
1203
+ #
1204
+ # Export data from the redis cache to blobs in a container.
1205
+ #
1206
+ # @param resource_group_name [String] The name of the resource group.
1207
+ # @param name [String] The name of the Redis cache.
1208
+ # @param parameters [ExportRDBParameters] Parameters for Redis export
1209
+ # operation.
1210
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1211
+ # to the HTTP request.
1212
+ #
1213
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1214
+ #
1215
+ def begin_export_data_async(resource_group_name, name, parameters, custom_headers:nil)
1216
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1217
+ fail ArgumentError, 'name is nil' if name.nil?
1218
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1219
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1220
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1221
+
1222
+
1223
+ request_headers = {}
1224
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1225
+
1226
+ # Set Headers
1227
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1228
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1229
+
1230
+ # Serialize Request
1231
+ request_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::ExportRDBParameters.mapper()
1232
+ request_content = @client.serialize(request_mapper, parameters)
1233
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1234
+
1235
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export'
1236
+
1237
+ request_url = @base_url || @client.base_url
1238
+
1239
+ options = {
1240
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1241
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
1242
+ query_params: {'api-version' => @client.api_version},
1243
+ body: request_content,
1244
+ headers: request_headers.merge(custom_headers || {}),
1245
+ base_url: request_url
1246
+ }
1247
+ promise = @client.make_request_async(:post, path_template, options)
1248
+
1249
+ promise = promise.then do |result|
1250
+ http_response = result.response
1251
+ status_code = http_response.status
1252
+ response_content = http_response.body
1253
+ unless status_code == 202 || status_code == 200 || status_code == 204
1254
+ error_model = JSON.load(response_content)
1255
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1256
+ end
1257
+
1258
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1259
+
1260
+ result
1261
+ end
1262
+
1263
+ promise.execute
1264
+ end
1265
+
1266
+ #
1267
+ # Lists all Redis caches in a resource group.
1268
+ #
1269
+ # @param next_page_link [String] The NextLink from the previous successful call
1270
+ # to List operation.
1271
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1272
+ # will be added to the HTTP request.
1273
+ #
1274
+ # @return [RedisListResult] operation results.
1275
+ #
1276
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
1277
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1278
+ response.body unless response.nil?
1279
+ end
1280
+
1281
+ #
1282
+ # Lists all Redis caches in a resource group.
1283
+ #
1284
+ # @param next_page_link [String] The NextLink from the previous successful call
1285
+ # to List operation.
1286
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1287
+ # will be added to the HTTP request.
1288
+ #
1289
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1290
+ #
1291
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
1292
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1293
+ end
1294
+
1295
+ #
1296
+ # Lists all Redis caches in a resource group.
1297
+ #
1298
+ # @param next_page_link [String] The NextLink from the previous successful call
1299
+ # to List operation.
1300
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1301
+ # to the HTTP request.
1302
+ #
1303
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1304
+ #
1305
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
1306
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1307
+
1308
+
1309
+ request_headers = {}
1310
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1311
+
1312
+ # Set Headers
1313
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1314
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1315
+ path_template = '{nextLink}'
1316
+
1317
+ request_url = @base_url || @client.base_url
1318
+
1319
+ options = {
1320
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1321
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1322
+ headers: request_headers.merge(custom_headers || {}),
1323
+ base_url: request_url
1324
+ }
1325
+ promise = @client.make_request_async(:get, path_template, options)
1326
+
1327
+ promise = promise.then do |result|
1328
+ http_response = result.response
1329
+ status_code = http_response.status
1330
+ response_content = http_response.body
1331
+ unless status_code == 200
1332
+ error_model = JSON.load(response_content)
1333
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1334
+ end
1335
+
1336
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1337
+ # Deserialize Response
1338
+ if status_code == 200
1339
+ begin
1340
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1341
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisListResult.mapper()
1342
+ result.body = @client.deserialize(result_mapper, parsed_response)
1343
+ rescue Exception => e
1344
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1345
+ end
1346
+ end
1347
+
1348
+ result
1349
+ end
1350
+
1351
+ promise.execute
1352
+ end
1353
+
1354
+ #
1355
+ # Gets all Redis caches in the specified subscription.
1356
+ #
1357
+ # @param next_page_link [String] The NextLink from the previous successful call
1358
+ # to List operation.
1359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1360
+ # will be added to the HTTP request.
1361
+ #
1362
+ # @return [RedisListResult] operation results.
1363
+ #
1364
+ def list_next(next_page_link, custom_headers:nil)
1365
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
1366
+ response.body unless response.nil?
1367
+ end
1368
+
1369
+ #
1370
+ # Gets all Redis caches in the specified subscription.
1371
+ #
1372
+ # @param next_page_link [String] The NextLink from the previous successful call
1373
+ # to List operation.
1374
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1375
+ # will be added to the HTTP request.
1376
+ #
1377
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1378
+ #
1379
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
1380
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
1381
+ end
1382
+
1383
+ #
1384
+ # Gets all Redis caches in the specified subscription.
1385
+ #
1386
+ # @param next_page_link [String] The NextLink from the previous successful call
1387
+ # to List operation.
1388
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1389
+ # to the HTTP request.
1390
+ #
1391
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1392
+ #
1393
+ def list_next_async(next_page_link, custom_headers:nil)
1394
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1395
+
1396
+
1397
+ request_headers = {}
1398
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1399
+
1400
+ # Set Headers
1401
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1402
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1403
+ path_template = '{nextLink}'
1404
+
1405
+ request_url = @base_url || @client.base_url
1406
+
1407
+ options = {
1408
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1409
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1410
+ headers: request_headers.merge(custom_headers || {}),
1411
+ base_url: request_url
1412
+ }
1413
+ promise = @client.make_request_async(:get, path_template, options)
1414
+
1415
+ promise = promise.then do |result|
1416
+ http_response = result.response
1417
+ status_code = http_response.status
1418
+ response_content = http_response.body
1419
+ unless status_code == 200
1420
+ error_model = JSON.load(response_content)
1421
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1422
+ end
1423
+
1424
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1425
+ # Deserialize Response
1426
+ if status_code == 200
1427
+ begin
1428
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1429
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisListResult.mapper()
1430
+ result.body = @client.deserialize(result_mapper, parsed_response)
1431
+ rescue Exception => e
1432
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1433
+ end
1434
+ end
1435
+
1436
+ result
1437
+ end
1438
+
1439
+ promise.execute
1440
+ end
1441
+
1442
+ #
1443
+ # Lists all Redis caches in a resource group.
1444
+ #
1445
+ # @param resource_group_name [String] The name of the resource group.
1446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1447
+ # will be added to the HTTP request.
1448
+ #
1449
+ # @return [RedisListResult] which provide lazy access to pages of the response.
1450
+ #
1451
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
1452
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
1453
+ unless response.nil?
1454
+ page = response.body
1455
+ page.next_method = Proc.new do |next_page_link|
1456
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1457
+ end
1458
+ page
1459
+ end
1460
+ end
1461
+
1462
+ #
1463
+ # Gets all Redis caches in the specified subscription.
1464
+ #
1465
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1466
+ # will be added to the HTTP request.
1467
+ #
1468
+ # @return [RedisListResult] which provide lazy access to pages of the response.
1469
+ #
1470
+ def list_as_lazy(custom_headers:nil)
1471
+ response = list_async(custom_headers:custom_headers).value!
1472
+ unless response.nil?
1473
+ page = response.body
1474
+ page.next_method = Proc.new do |next_page_link|
1475
+ list_next_async(next_page_link, custom_headers:custom_headers)
1476
+ end
1477
+ page
1478
+ end
1479
+ end
1480
+
1481
+ end
1482
+ end