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,594 @@
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 LinkedServer
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the LinkedServer 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
+ # Adds a linked server to the Redis cache (requires Premium SKU).
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param name [String] The name of the Redis cache.
29
+ # @param linked_server_name [String] The name of the linked server that is
30
+ # being added to the Redis cache.
31
+ # @param parameters [RedisLinkedServerCreateParameters] Parameters supplied to
32
+ # the Create Linked server operation.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [RedisLinkedServerWithProperties] operation results.
37
+ #
38
+ def create(resource_group_name, name, linked_server_name, parameters, custom_headers:nil)
39
+ response = create_async(resource_group_name, name, linked_server_name, parameters, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group.
45
+ # @param name [String] The name of the Redis cache.
46
+ # @param linked_server_name [String] The name of the linked server that is
47
+ # being added to the Redis cache.
48
+ # @param parameters [RedisLinkedServerCreateParameters] Parameters supplied to
49
+ # the Create Linked server operation.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [Concurrent::Promise] promise which provides async access to http
54
+ # response.
55
+ #
56
+ def create_async(resource_group_name, name, linked_server_name, parameters, custom_headers:nil)
57
+ # Send request
58
+ promise = begin_create_async(resource_group_name, name, linked_server_name, parameters, custom_headers:custom_headers)
59
+
60
+ promise = promise.then do |response|
61
+ # Defining deserialization method.
62
+ deserialize_method = lambda do |parsed_response|
63
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisLinkedServerWithProperties.mapper()
64
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
65
+ end
66
+
67
+ # Waiting for response.
68
+ @client.get_long_running_operation_result(response, deserialize_method)
69
+ end
70
+
71
+ promise
72
+ end
73
+
74
+ #
75
+ # Deletes the linked server from a redis cache (requires Premium SKU).
76
+ #
77
+ # @param resource_group_name [String] The name of the resource group.
78
+ # @param name [String] The name of the redis cache.
79
+ # @param linked_server_name [String] The name of the linked server that is
80
+ # being added to the Redis cache.
81
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
82
+ # will be added to the HTTP request.
83
+ #
84
+ #
85
+ def delete(resource_group_name, name, linked_server_name, custom_headers:nil)
86
+ response = delete_async(resource_group_name, name, linked_server_name, custom_headers:custom_headers).value!
87
+ nil
88
+ end
89
+
90
+ #
91
+ # Deletes the linked server from a redis cache (requires Premium SKU).
92
+ #
93
+ # @param resource_group_name [String] The name of the resource group.
94
+ # @param name [String] The name of the redis cache.
95
+ # @param linked_server_name [String] The name of the linked server that is
96
+ # being added to the Redis cache.
97
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
98
+ # will be added to the HTTP request.
99
+ #
100
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
101
+ #
102
+ def delete_with_http_info(resource_group_name, name, linked_server_name, custom_headers:nil)
103
+ delete_async(resource_group_name, name, linked_server_name, custom_headers:custom_headers).value!
104
+ end
105
+
106
+ #
107
+ # Deletes the linked server from a redis cache (requires Premium SKU).
108
+ #
109
+ # @param resource_group_name [String] The name of the resource group.
110
+ # @param name [String] The name of the redis cache.
111
+ # @param linked_server_name [String] The name of the linked server that is
112
+ # being added to the Redis cache.
113
+ # @param [Hash{String => String}] A hash of custom headers that will be added
114
+ # to the HTTP request.
115
+ #
116
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
117
+ #
118
+ def delete_async(resource_group_name, name, linked_server_name, custom_headers:nil)
119
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
120
+ fail ArgumentError, 'name is nil' if name.nil?
121
+ fail ArgumentError, 'linked_server_name is nil' if linked_server_name.nil?
122
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
123
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
124
+
125
+
126
+ request_headers = {}
127
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
128
+
129
+ # Set Headers
130
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
131
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
132
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/linkedServers/{linkedServerName}'
133
+
134
+ request_url = @base_url || @client.base_url
135
+
136
+ options = {
137
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
138
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'linkedServerName' => linked_server_name,'subscriptionId' => @client.subscription_id},
139
+ query_params: {'api-version' => @client.api_version},
140
+ headers: request_headers.merge(custom_headers || {}),
141
+ base_url: request_url
142
+ }
143
+ promise = @client.make_request_async(:delete, path_template, options)
144
+
145
+ promise = promise.then do |result|
146
+ http_response = result.response
147
+ status_code = http_response.status
148
+ response_content = http_response.body
149
+ unless status_code == 200
150
+ error_model = JSON.load(response_content)
151
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
152
+ end
153
+
154
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
155
+
156
+ result
157
+ end
158
+
159
+ promise.execute
160
+ end
161
+
162
+ #
163
+ # Gets the detailed information about a linked server of a redis cache
164
+ # (requires Premium SKU).
165
+ #
166
+ # @param resource_group_name [String] The name of the resource group.
167
+ # @param name [String] The name of the redis cache.
168
+ # @param linked_server_name [String] The name of the linked server.
169
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
170
+ # will be added to the HTTP request.
171
+ #
172
+ # @return [RedisLinkedServerWithProperties] operation results.
173
+ #
174
+ def get(resource_group_name, name, linked_server_name, custom_headers:nil)
175
+ response = get_async(resource_group_name, name, linked_server_name, custom_headers:custom_headers).value!
176
+ response.body unless response.nil?
177
+ end
178
+
179
+ #
180
+ # Gets the detailed information about a linked server of a redis cache
181
+ # (requires Premium SKU).
182
+ #
183
+ # @param resource_group_name [String] The name of the resource group.
184
+ # @param name [String] The name of the redis cache.
185
+ # @param linked_server_name [String] The name of the linked server.
186
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
187
+ # will be added to the HTTP request.
188
+ #
189
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
190
+ #
191
+ def get_with_http_info(resource_group_name, name, linked_server_name, custom_headers:nil)
192
+ get_async(resource_group_name, name, linked_server_name, custom_headers:custom_headers).value!
193
+ end
194
+
195
+ #
196
+ # Gets the detailed information about a linked server of a redis cache
197
+ # (requires Premium SKU).
198
+ #
199
+ # @param resource_group_name [String] The name of the resource group.
200
+ # @param name [String] The name of the redis cache.
201
+ # @param linked_server_name [String] The name of the linked server.
202
+ # @param [Hash{String => String}] A hash of custom headers that will be added
203
+ # to the HTTP request.
204
+ #
205
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
206
+ #
207
+ def get_async(resource_group_name, name, linked_server_name, custom_headers:nil)
208
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
209
+ fail ArgumentError, 'name is nil' if name.nil?
210
+ fail ArgumentError, 'linked_server_name is nil' if linked_server_name.nil?
211
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
212
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
213
+
214
+
215
+ request_headers = {}
216
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
217
+
218
+ # Set Headers
219
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
220
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
221
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/linkedServers/{linkedServerName}'
222
+
223
+ request_url = @base_url || @client.base_url
224
+
225
+ options = {
226
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
227
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'linkedServerName' => linked_server_name,'subscriptionId' => @client.subscription_id},
228
+ query_params: {'api-version' => @client.api_version},
229
+ headers: request_headers.merge(custom_headers || {}),
230
+ base_url: request_url
231
+ }
232
+ promise = @client.make_request_async(:get, path_template, options)
233
+
234
+ promise = promise.then do |result|
235
+ http_response = result.response
236
+ status_code = http_response.status
237
+ response_content = http_response.body
238
+ unless status_code == 200
239
+ error_model = JSON.load(response_content)
240
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
241
+ end
242
+
243
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
244
+ # Deserialize Response
245
+ if status_code == 200
246
+ begin
247
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
248
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisLinkedServerWithProperties.mapper()
249
+ result.body = @client.deserialize(result_mapper, parsed_response)
250
+ rescue Exception => e
251
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
252
+ end
253
+ end
254
+
255
+ result
256
+ end
257
+
258
+ promise.execute
259
+ end
260
+
261
+ #
262
+ # Gets the list of linked servers associated with this redis cache (requires
263
+ # Premium SKU).
264
+ #
265
+ # @param resource_group_name [String] The name of the resource group.
266
+ # @param name [String] The name of the redis cache.
267
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
268
+ # will be added to the HTTP request.
269
+ #
270
+ # @return [Array<RedisLinkedServerWithProperties>] operation results.
271
+ #
272
+ def list(resource_group_name, name, custom_headers:nil)
273
+ first_page = list_as_lazy(resource_group_name, name, custom_headers:custom_headers)
274
+ first_page.get_all_items
275
+ end
276
+
277
+ #
278
+ # Gets the list of linked servers associated with this redis cache (requires
279
+ # Premium SKU).
280
+ #
281
+ # @param resource_group_name [String] The name of the resource group.
282
+ # @param name [String] The name of the redis cache.
283
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
284
+ # will be added to the HTTP request.
285
+ #
286
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
287
+ #
288
+ def list_with_http_info(resource_group_name, name, custom_headers:nil)
289
+ list_async(resource_group_name, name, custom_headers:custom_headers).value!
290
+ end
291
+
292
+ #
293
+ # Gets the list of linked servers associated with this redis cache (requires
294
+ # Premium SKU).
295
+ #
296
+ # @param resource_group_name [String] The name of the resource group.
297
+ # @param name [String] The name of the redis cache.
298
+ # @param [Hash{String => String}] A hash of custom headers that will be added
299
+ # to the HTTP request.
300
+ #
301
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
302
+ #
303
+ def list_async(resource_group_name, name, custom_headers:nil)
304
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
305
+ fail ArgumentError, 'name is nil' if name.nil?
306
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
307
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
308
+
309
+
310
+ request_headers = {}
311
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
312
+
313
+ # Set Headers
314
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
315
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
316
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/linkedServers'
317
+
318
+ request_url = @base_url || @client.base_url
319
+
320
+ options = {
321
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
322
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
323
+ query_params: {'api-version' => @client.api_version},
324
+ headers: request_headers.merge(custom_headers || {}),
325
+ base_url: request_url
326
+ }
327
+ promise = @client.make_request_async(:get, path_template, options)
328
+
329
+ promise = promise.then do |result|
330
+ http_response = result.response
331
+ status_code = http_response.status
332
+ response_content = http_response.body
333
+ unless status_code == 200
334
+ error_model = JSON.load(response_content)
335
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
336
+ end
337
+
338
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
339
+ # Deserialize Response
340
+ if status_code == 200
341
+ begin
342
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
343
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisLinkedServerWithPropertiesList.mapper()
344
+ result.body = @client.deserialize(result_mapper, parsed_response)
345
+ rescue Exception => e
346
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
347
+ end
348
+ end
349
+
350
+ result
351
+ end
352
+
353
+ promise.execute
354
+ end
355
+
356
+ #
357
+ # Adds a linked server to the Redis cache (requires Premium SKU).
358
+ #
359
+ # @param resource_group_name [String] The name of the resource group.
360
+ # @param name [String] The name of the Redis cache.
361
+ # @param linked_server_name [String] The name of the linked server that is
362
+ # being added to the Redis cache.
363
+ # @param parameters [RedisLinkedServerCreateParameters] Parameters supplied to
364
+ # the Create Linked server operation.
365
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
366
+ # will be added to the HTTP request.
367
+ #
368
+ # @return [RedisLinkedServerWithProperties] operation results.
369
+ #
370
+ def begin_create(resource_group_name, name, linked_server_name, parameters, custom_headers:nil)
371
+ response = begin_create_async(resource_group_name, name, linked_server_name, parameters, custom_headers:custom_headers).value!
372
+ response.body unless response.nil?
373
+ end
374
+
375
+ #
376
+ # Adds a linked server to the Redis cache (requires Premium SKU).
377
+ #
378
+ # @param resource_group_name [String] The name of the resource group.
379
+ # @param name [String] The name of the Redis cache.
380
+ # @param linked_server_name [String] The name of the linked server that is
381
+ # being added to the Redis cache.
382
+ # @param parameters [RedisLinkedServerCreateParameters] Parameters supplied to
383
+ # the Create Linked server operation.
384
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
385
+ # will be added to the HTTP request.
386
+ #
387
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
388
+ #
389
+ def begin_create_with_http_info(resource_group_name, name, linked_server_name, parameters, custom_headers:nil)
390
+ begin_create_async(resource_group_name, name, linked_server_name, parameters, custom_headers:custom_headers).value!
391
+ end
392
+
393
+ #
394
+ # Adds a linked server to the Redis cache (requires Premium SKU).
395
+ #
396
+ # @param resource_group_name [String] The name of the resource group.
397
+ # @param name [String] The name of the Redis cache.
398
+ # @param linked_server_name [String] The name of the linked server that is
399
+ # being added to the Redis cache.
400
+ # @param parameters [RedisLinkedServerCreateParameters] Parameters supplied to
401
+ # the Create Linked server operation.
402
+ # @param [Hash{String => String}] A hash of custom headers that will be added
403
+ # to the HTTP request.
404
+ #
405
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
406
+ #
407
+ def begin_create_async(resource_group_name, name, linked_server_name, parameters, custom_headers:nil)
408
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
409
+ fail ArgumentError, 'name is nil' if name.nil?
410
+ fail ArgumentError, 'linked_server_name is nil' if linked_server_name.nil?
411
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
412
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
413
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
414
+
415
+
416
+ request_headers = {}
417
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
418
+
419
+ # Set Headers
420
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
421
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
422
+
423
+ # Serialize Request
424
+ request_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisLinkedServerCreateParameters.mapper()
425
+ request_content = @client.serialize(request_mapper, parameters)
426
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
427
+
428
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/linkedServers/{linkedServerName}'
429
+
430
+ request_url = @base_url || @client.base_url
431
+
432
+ options = {
433
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
434
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'linkedServerName' => linked_server_name,'subscriptionId' => @client.subscription_id},
435
+ query_params: {'api-version' => @client.api_version},
436
+ body: request_content,
437
+ headers: request_headers.merge(custom_headers || {}),
438
+ base_url: request_url
439
+ }
440
+ promise = @client.make_request_async(:put, path_template, options)
441
+
442
+ promise = promise.then do |result|
443
+ http_response = result.response
444
+ status_code = http_response.status
445
+ response_content = http_response.body
446
+ unless status_code == 200 || status_code == 201
447
+ error_model = JSON.load(response_content)
448
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
449
+ end
450
+
451
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
452
+ # Deserialize Response
453
+ if status_code == 200
454
+ begin
455
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
456
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisLinkedServerWithProperties.mapper()
457
+ result.body = @client.deserialize(result_mapper, parsed_response)
458
+ rescue Exception => e
459
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
460
+ end
461
+ end
462
+ # Deserialize Response
463
+ if status_code == 201
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::RedisLinkedServerWithProperties.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
+ # Gets the list of linked servers associated with this redis cache (requires
481
+ # Premium SKU).
482
+ #
483
+ # @param next_page_link [String] The NextLink from the previous successful call
484
+ # to List operation.
485
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
486
+ # will be added to the HTTP request.
487
+ #
488
+ # @return [RedisLinkedServerWithPropertiesList] operation results.
489
+ #
490
+ def list_next(next_page_link, custom_headers:nil)
491
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
492
+ response.body unless response.nil?
493
+ end
494
+
495
+ #
496
+ # Gets the list of linked servers associated with this redis cache (requires
497
+ # Premium SKU).
498
+ #
499
+ # @param next_page_link [String] The NextLink from the previous successful call
500
+ # to List operation.
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_next_with_http_info(next_page_link, custom_headers:nil)
507
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
508
+ end
509
+
510
+ #
511
+ # Gets the list of linked servers associated with this redis cache (requires
512
+ # Premium SKU).
513
+ #
514
+ # @param next_page_link [String] The NextLink from the previous successful call
515
+ # to List operation.
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_next_async(next_page_link, custom_headers:nil)
522
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
523
+
524
+
525
+ request_headers = {}
526
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
527
+
528
+ # Set Headers
529
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
530
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
531
+ path_template = '{nextLink}'
532
+
533
+ request_url = @base_url || @client.base_url
534
+
535
+ options = {
536
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
537
+ skip_encoding_path_params: {'nextLink' => next_page_link},
538
+ headers: request_headers.merge(custom_headers || {}),
539
+ base_url: request_url
540
+ }
541
+ promise = @client.make_request_async(:get, path_template, options)
542
+
543
+ promise = promise.then do |result|
544
+ http_response = result.response
545
+ status_code = http_response.status
546
+ response_content = http_response.body
547
+ unless status_code == 200
548
+ error_model = JSON.load(response_content)
549
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
550
+ end
551
+
552
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
553
+ # Deserialize Response
554
+ if status_code == 200
555
+ begin
556
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
557
+ result_mapper = Azure::Redis::Mgmt::V2017_10_01::Models::RedisLinkedServerWithPropertiesList.mapper()
558
+ result.body = @client.deserialize(result_mapper, parsed_response)
559
+ rescue Exception => e
560
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
561
+ end
562
+ end
563
+
564
+ result
565
+ end
566
+
567
+ promise.execute
568
+ end
569
+
570
+ #
571
+ # Gets the list of linked servers associated with this redis cache (requires
572
+ # Premium SKU).
573
+ #
574
+ # @param resource_group_name [String] The name of the resource group.
575
+ # @param name [String] The name of the redis cache.
576
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
577
+ # will be added to the HTTP request.
578
+ #
579
+ # @return [RedisLinkedServerWithPropertiesList] which provide lazy access to
580
+ # pages of the response.
581
+ #
582
+ def list_as_lazy(resource_group_name, name, custom_headers:nil)
583
+ response = list_async(resource_group_name, name, custom_headers:custom_headers).value!
584
+ unless response.nil?
585
+ page = response.body
586
+ page.next_method = Proc.new do |next_page_link|
587
+ list_next_async(next_page_link, custom_headers:custom_headers)
588
+ end
589
+ page
590
+ end
591
+ end
592
+
593
+ end
594
+ end