azure_mgmt_redis 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Redis
7
+ module Models
8
+ #
9
+ # Specifies which redis node(s) to reboot.
10
+ #
11
+ class RedisRebootParameters
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [RebootType] Which redis node(s) to reboot. Depending on this
16
+ # value data loss is possible. Possible values include: 'PrimaryNode',
17
+ # 'SecondaryNode', 'AllNodes'
18
+ attr_accessor :reboot_type
19
+
20
+ # @return [Integer] In case of cluster cache, this specifies shard id
21
+ # which should be rebooted.
22
+ attr_accessor :shard_id
23
+
24
+ #
25
+ # Validate the object. Throws ValidationError if validation fails.
26
+ #
27
+ def validate
28
+ fail MsRest::ValidationError, 'property reboot_type is nil' if @reboot_type.nil?
29
+ end
30
+
31
+ #
32
+ # Serializes given Model object into Ruby Hash.
33
+ # @param object Model object to serialize.
34
+ # @return [Hash] Serialized object in form of Ruby Hash.
35
+ #
36
+ def self.serialize_object(object)
37
+ object.validate
38
+ output_object = {}
39
+
40
+ serialized_property = object.reboot_type
41
+ output_object['rebootType'] = serialized_property unless serialized_property.nil?
42
+
43
+ serialized_property = object.shard_id
44
+ output_object['shardId'] = serialized_property unless serialized_property.nil?
45
+
46
+ output_object
47
+ end
48
+
49
+ #
50
+ # Deserializes given Ruby Hash into Model object.
51
+ # @param object [Hash] Ruby Hash object to deserialize.
52
+ # @return [RedisRebootParameters] Deserialized object.
53
+ #
54
+ def self.deserialize_object(object)
55
+ return if object.nil?
56
+ output_object = RedisRebootParameters.new
57
+
58
+ deserialized_property = object['rebootType']
59
+ if (!deserialized_property.nil? && !deserialized_property.empty?)
60
+ enum_is_valid = RebootType.constants.any? { |e| RebootType.const_get(e).to_s.downcase == deserialized_property.downcase }
61
+ warn 'Enum RebootType does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
62
+ end
63
+ output_object.reboot_type = deserialized_property
64
+
65
+ deserialized_property = object['shardId']
66
+ deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty?
67
+ output_object.shard_id = deserialized_property
68
+
69
+ output_object
70
+ end
71
+ end
72
+ end
73
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -31,13 +31,47 @@ module Azure::ARM::Redis
31
31
  # @param name [String] The name of the redis cache.
32
32
  # @param parameters [RedisCreateOrUpdateParameters] Parameters supplied to the
33
33
  # CreateOrUpdate redis operation.
34
- # @param [Hash{String => String}] The hash of custom headers need to be
35
- # applied to HTTP request.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
36
  #
37
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
38
- # response.
37
+ # @return [RedisResourceWithAccessKey] operation results.
39
38
  #
40
39
  def create_or_update(resource_group_name, name, parameters, custom_headers = nil)
40
+ response = create_or_update_async(resource_group_name, name, parameters, custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Create a redis cache, or replace (overwrite/recreate, with potential
46
+ # downtime) an existing cache
47
+ #
48
+ # @param resource_group_name [String] The name of the resource group.
49
+ # @param name [String] The name of the redis cache.
50
+ # @param parameters [RedisCreateOrUpdateParameters] Parameters supplied to the
51
+ # CreateOrUpdate redis operation.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def create_or_update_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
58
+ create_or_update_async(resource_group_name, name, parameters, custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Create a redis cache, or replace (overwrite/recreate, with potential
63
+ # downtime) an existing cache
64
+ #
65
+ # @param resource_group_name [String] The name of the resource group.
66
+ # @param name [String] The name of the redis cache.
67
+ # @param parameters [RedisCreateOrUpdateParameters] Parameters supplied to the
68
+ # CreateOrUpdate redis operation.
69
+ # @param [Hash{String => String}] A hash of custom headers that will be added
70
+ # to the HTTP request.
71
+ #
72
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
73
+ #
74
+ def create_or_update_async(resource_group_name, name, parameters, custom_headers = nil)
41
75
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
42
76
  fail ArgumentError, 'name is nil' if name.nil?
43
77
  fail ArgumentError, 'parameters is nil' if parameters.nil?
@@ -55,7 +89,7 @@ module Azure::ARM::Redis
55
89
  unless parameters.nil?
56
90
  parameters = RedisCreateOrUpdateParameters.serialize_object(parameters)
57
91
  end
58
- request_content = JSON.generate(parameters, quirks_mode: true)
92
+ request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
59
93
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
60
94
  options = {
61
95
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -64,7 +98,10 @@ module Azure::ARM::Redis
64
98
  body: request_content,
65
99
  headers: request_headers.merge(custom_headers || {})
66
100
  }
67
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
101
+
102
+ request_url = @base_url || @client.base_url
103
+
104
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
68
105
  promise = request.run_promise do |req|
69
106
  @client.credentials.sign_request(req) unless @client.credentials.nil?
70
107
  end
@@ -116,13 +153,40 @@ module Azure::ARM::Redis
116
153
  #
117
154
  # @param resource_group_name [String] The name of the resource group.
118
155
  # @param name [String] The name of the redis cache.
119
- # @param [Hash{String => String}] The hash of custom headers need to be
120
- # applied to HTTP request.
156
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
157
+ # will be added to the HTTP request.
121
158
  #
122
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
123
- # response.
124
159
  #
125
160
  def delete(resource_group_name, name, custom_headers = nil)
161
+ response = delete_async(resource_group_name, name, custom_headers).value!
162
+ nil
163
+ end
164
+
165
+ #
166
+ # Deletes a redis cache. This operation takes a while to complete.
167
+ #
168
+ # @param resource_group_name [String] The name of the resource group.
169
+ # @param name [String] The name of the redis cache.
170
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
171
+ # will be added to the HTTP request.
172
+ #
173
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
174
+ #
175
+ def delete_with_http_info(resource_group_name, name, custom_headers = nil)
176
+ delete_async(resource_group_name, name, custom_headers).value!
177
+ end
178
+
179
+ #
180
+ # Deletes a redis cache. This operation takes a while to complete.
181
+ #
182
+ # @param resource_group_name [String] The name of the resource group.
183
+ # @param name [String] The name of the redis cache.
184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
185
+ # to the HTTP request.
186
+ #
187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
188
+ #
189
+ def delete_async(resource_group_name, name, custom_headers = nil)
126
190
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
127
191
  fail ArgumentError, 'name is nil' if name.nil?
128
192
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
@@ -139,7 +203,10 @@ module Azure::ARM::Redis
139
203
  query_params: {'api-version' => @client.api_version},
140
204
  headers: request_headers.merge(custom_headers || {})
141
205
  }
142
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
206
+
207
+ request_url = @base_url || @client.base_url
208
+
209
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
143
210
  promise = request.run_promise do |req|
144
211
  @client.credentials.sign_request(req) unless @client.credentials.nil?
145
212
  end
@@ -167,13 +234,41 @@ module Azure::ARM::Redis
167
234
  #
168
235
  # @param resource_group_name [String] The name of the resource group.
169
236
  # @param name [String] The name of the redis cache.
170
- # @param [Hash{String => String}] The hash of custom headers need to be
171
- # applied to HTTP request.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
172
239
  #
173
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
174
- # response.
240
+ # @return [RedisResource] operation results.
175
241
  #
176
242
  def get(resource_group_name, name, custom_headers = nil)
243
+ response = get_async(resource_group_name, name, custom_headers).value!
244
+ response.body unless response.nil?
245
+ end
246
+
247
+ #
248
+ # Gets a redis cache (resource description).
249
+ #
250
+ # @param resource_group_name [String] The name of the resource group.
251
+ # @param name [String] The name of the redis cache.
252
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
253
+ # will be added to the HTTP request.
254
+ #
255
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
256
+ #
257
+ def get_with_http_info(resource_group_name, name, custom_headers = nil)
258
+ get_async(resource_group_name, name, custom_headers).value!
259
+ end
260
+
261
+ #
262
+ # Gets a redis cache (resource description).
263
+ #
264
+ # @param resource_group_name [String] The name of the resource group.
265
+ # @param name [String] The name of the redis cache.
266
+ # @param [Hash{String => String}] A hash of custom headers that will be added
267
+ # to the HTTP request.
268
+ #
269
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
270
+ #
271
+ def get_async(resource_group_name, name, custom_headers = nil)
177
272
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
178
273
  fail ArgumentError, 'name is nil' if name.nil?
179
274
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
@@ -190,7 +285,10 @@ module Azure::ARM::Redis
190
285
  query_params: {'api-version' => @client.api_version},
191
286
  headers: request_headers.merge(custom_headers || {})
192
287
  }
193
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
288
+
289
+ request_url = @base_url || @client.base_url
290
+
291
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
194
292
  promise = request.run_promise do |req|
195
293
  @client.credentials.sign_request(req) unless @client.credentials.nil?
196
294
  end
@@ -229,13 +327,39 @@ module Azure::ARM::Redis
229
327
  # Gets all redis caches in a resource group.
230
328
  #
231
329
  # @param resource_group_name [String] The name of the resource group.
232
- # @param [Hash{String => String}] The hash of custom headers need to be
233
- # applied to HTTP request.
330
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
331
+ # will be added to the HTTP request.
234
332
  #
235
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
236
- # response.
333
+ # @return [RedisListResult] operation results.
237
334
  #
238
335
  def list_by_resource_group(resource_group_name, custom_headers = nil)
336
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
337
+ response.body unless response.nil?
338
+ end
339
+
340
+ #
341
+ # Gets all redis caches in a resource group.
342
+ #
343
+ # @param resource_group_name [String] The name of the resource group.
344
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
345
+ # will be added to the HTTP request.
346
+ #
347
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
348
+ #
349
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
350
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
351
+ end
352
+
353
+ #
354
+ # Gets all redis caches in a resource group.
355
+ #
356
+ # @param resource_group_name [String] The name of the resource group.
357
+ # @param [Hash{String => String}] A hash of custom headers that will be added
358
+ # to the HTTP request.
359
+ #
360
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
361
+ #
362
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
239
363
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
240
364
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
241
365
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -251,7 +375,10 @@ module Azure::ARM::Redis
251
375
  query_params: {'api-version' => @client.api_version},
252
376
  headers: request_headers.merge(custom_headers || {})
253
377
  }
254
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
378
+
379
+ request_url = @base_url || @client.base_url
380
+
381
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
255
382
  promise = request.run_promise do |req|
256
383
  @client.credentials.sign_request(req) unless @client.credentials.nil?
257
384
  end
@@ -289,13 +416,37 @@ module Azure::ARM::Redis
289
416
  #
290
417
  # Gets all redis caches in the specified subscription.
291
418
  #
292
- # @param [Hash{String => String}] The hash of custom headers need to be
293
- # applied to HTTP request.
419
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
420
+ # will be added to the HTTP request.
294
421
  #
295
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
296
- # response.
422
+ # @return [RedisListResult] operation results.
297
423
  #
298
424
  def list(custom_headers = nil)
425
+ response = list_async(custom_headers).value!
426
+ response.body unless response.nil?
427
+ end
428
+
429
+ #
430
+ # Gets all redis caches in the specified subscription.
431
+ #
432
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
433
+ # will be added to the HTTP request.
434
+ #
435
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
436
+ #
437
+ def list_with_http_info(custom_headers = nil)
438
+ list_async(custom_headers).value!
439
+ end
440
+
441
+ #
442
+ # Gets all redis caches in the specified subscription.
443
+ #
444
+ # @param [Hash{String => String}] A hash of custom headers that will be added
445
+ # to the HTTP request.
446
+ #
447
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
448
+ #
449
+ def list_async(custom_headers = nil)
299
450
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
300
451
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
301
452
  request_headers = {}
@@ -310,7 +461,10 @@ module Azure::ARM::Redis
310
461
  query_params: {'api-version' => @client.api_version},
311
462
  headers: request_headers.merge(custom_headers || {})
312
463
  }
313
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
464
+
465
+ request_url = @base_url || @client.base_url
466
+
467
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
314
468
  promise = request.run_promise do |req|
315
469
  @client.credentials.sign_request(req) unless @client.credentials.nil?
316
470
  end
@@ -351,13 +505,43 @@ module Azure::ARM::Redis
351
505
  #
352
506
  # @param resource_group_name [String] The name of the resource group.
353
507
  # @param name [String] The name of the redis cache.
354
- # @param [Hash{String => String}] The hash of custom headers need to be
355
- # applied to HTTP request.
508
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
509
+ # will be added to the HTTP request.
356
510
  #
357
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
358
- # response.
511
+ # @return [RedisListKeysResult] operation results.
359
512
  #
360
513
  def list_keys(resource_group_name, name, custom_headers = nil)
514
+ response = list_keys_async(resource_group_name, name, custom_headers).value!
515
+ response.body unless response.nil?
516
+ end
517
+
518
+ #
519
+ # Retrieve a redis cache's access keys. This operation requires write
520
+ # permission to the cache resource.
521
+ #
522
+ # @param resource_group_name [String] The name of the resource group.
523
+ # @param name [String] The name of the redis cache.
524
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
525
+ # will be added to the HTTP request.
526
+ #
527
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
528
+ #
529
+ def list_keys_with_http_info(resource_group_name, name, custom_headers = nil)
530
+ list_keys_async(resource_group_name, name, custom_headers).value!
531
+ end
532
+
533
+ #
534
+ # Retrieve a redis cache's access keys. This operation requires write
535
+ # permission to the cache resource.
536
+ #
537
+ # @param resource_group_name [String] The name of the resource group.
538
+ # @param name [String] The name of the redis cache.
539
+ # @param [Hash{String => String}] A hash of custom headers that will be added
540
+ # to the HTTP request.
541
+ #
542
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
543
+ #
544
+ def list_keys_async(resource_group_name, name, custom_headers = nil)
361
545
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
362
546
  fail ArgumentError, 'name is nil' if name.nil?
363
547
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
@@ -374,7 +558,10 @@ module Azure::ARM::Redis
374
558
  query_params: {'api-version' => @client.api_version},
375
559
  headers: request_headers.merge(custom_headers || {})
376
560
  }
377
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
561
+
562
+ request_url = @base_url || @client.base_url
563
+
564
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
378
565
  promise = request.run_promise do |req|
379
566
  @client.credentials.sign_request(req) unless @client.credentials.nil?
380
567
  end
@@ -417,13 +604,47 @@ module Azure::ARM::Redis
417
604
  # @param name [String] The name of the redis cache.
418
605
  # @param parameters [RedisRegenerateKeyParameters] Specifies which key to
419
606
  # reset.
420
- # @param [Hash{String => String}] The hash of custom headers need to be
421
- # applied to HTTP request.
607
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
608
+ # will be added to the HTTP request.
422
609
  #
423
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
424
- # response.
610
+ # @return [RedisListKeysResult] operation results.
425
611
  #
426
612
  def regenerate_key(resource_group_name, name, parameters, custom_headers = nil)
613
+ response = regenerate_key_async(resource_group_name, name, parameters, custom_headers).value!
614
+ response.body unless response.nil?
615
+ end
616
+
617
+ #
618
+ # Regenerate redis cache's access keys. This operation requires write
619
+ # permission to the cache resource.
620
+ #
621
+ # @param resource_group_name [String] The name of the resource group.
622
+ # @param name [String] The name of the redis cache.
623
+ # @param parameters [RedisRegenerateKeyParameters] Specifies which key to
624
+ # reset.
625
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
626
+ # will be added to the HTTP request.
627
+ #
628
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
629
+ #
630
+ def regenerate_key_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
631
+ regenerate_key_async(resource_group_name, name, parameters, custom_headers).value!
632
+ end
633
+
634
+ #
635
+ # Regenerate redis cache's access keys. This operation requires write
636
+ # permission to the cache resource.
637
+ #
638
+ # @param resource_group_name [String] The name of the resource group.
639
+ # @param name [String] The name of the redis cache.
640
+ # @param parameters [RedisRegenerateKeyParameters] Specifies which key to
641
+ # reset.
642
+ # @param [Hash{String => String}] A hash of custom headers that will be added
643
+ # to the HTTP request.
644
+ #
645
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
646
+ #
647
+ def regenerate_key_async(resource_group_name, name, parameters, custom_headers = nil)
427
648
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
428
649
  fail ArgumentError, 'name is nil' if name.nil?
429
650
  fail ArgumentError, 'parameters is nil' if parameters.nil?
@@ -441,7 +662,7 @@ module Azure::ARM::Redis
441
662
  unless parameters.nil?
442
663
  parameters = RedisRegenerateKeyParameters.serialize_object(parameters)
443
664
  end
444
- request_content = JSON.generate(parameters, quirks_mode: true)
665
+ request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
445
666
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey'
446
667
  options = {
447
668
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -450,7 +671,10 @@ module Azure::ARM::Redis
450
671
  body: request_content,
451
672
  headers: request_headers.merge(custom_headers || {})
452
673
  }
453
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
674
+
675
+ request_url = @base_url || @client.base_url
676
+
677
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
454
678
  promise = request.run_promise do |req|
455
679
  @client.credentials.sign_request(req) unless @client.credentials.nil?
456
680
  end
@@ -485,18 +709,146 @@ module Azure::ARM::Redis
485
709
  promise.execute
486
710
  end
487
711
 
712
+ #
713
+ # Reboot specified redis node(s). This operation requires write permission to
714
+ # the cache resource. There can be potential data loss.
715
+ #
716
+ # @param resource_group_name [String] The name of the resource group.
717
+ # @param name [String] The name of the redis cache.
718
+ # @param parameters [RedisRebootParameters] Specifies which redis node(s) to
719
+ # reboot.
720
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
721
+ # will be added to the HTTP request.
722
+ #
723
+ #
724
+ def force_reboot(resource_group_name, name, parameters, custom_headers = nil)
725
+ response = force_reboot_async(resource_group_name, name, parameters, custom_headers).value!
726
+ nil
727
+ end
728
+
729
+ #
730
+ # Reboot specified redis node(s). This operation requires write permission to
731
+ # the cache resource. There can be potential data loss.
732
+ #
733
+ # @param resource_group_name [String] The name of the resource group.
734
+ # @param name [String] The name of the redis cache.
735
+ # @param parameters [RedisRebootParameters] Specifies which redis node(s) to
736
+ # reboot.
737
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
738
+ # will be added to the HTTP request.
739
+ #
740
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
741
+ #
742
+ def force_reboot_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
743
+ force_reboot_async(resource_group_name, name, parameters, custom_headers).value!
744
+ end
745
+
746
+ #
747
+ # Reboot specified redis node(s). This operation requires write permission to
748
+ # the cache resource. There can be potential data loss.
749
+ #
750
+ # @param resource_group_name [String] The name of the resource group.
751
+ # @param name [String] The name of the redis cache.
752
+ # @param parameters [RedisRebootParameters] Specifies which redis node(s) to
753
+ # reboot.
754
+ # @param [Hash{String => String}] A hash of custom headers that will be added
755
+ # to the HTTP request.
756
+ #
757
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
758
+ #
759
+ def force_reboot_async(resource_group_name, name, parameters, custom_headers = nil)
760
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
761
+ fail ArgumentError, 'name is nil' if name.nil?
762
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
763
+ parameters.validate unless parameters.nil?
764
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
765
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
766
+ request_headers = {}
767
+
768
+ # Set Headers
769
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
770
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
771
+
772
+ # Serialize Request
773
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
774
+ unless parameters.nil?
775
+ parameters = RedisRebootParameters.serialize_object(parameters)
776
+ end
777
+ request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
778
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot'
779
+ options = {
780
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
781
+ path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
782
+ query_params: {'api-version' => @client.api_version},
783
+ body: request_content,
784
+ headers: request_headers.merge(custom_headers || {})
785
+ }
786
+
787
+ request_url = @base_url || @client.base_url
788
+
789
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
790
+ promise = request.run_promise do |req|
791
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
792
+ end
793
+
794
+ promise = promise.then do |http_response|
795
+ status_code = http_response.status
796
+ response_content = http_response.body
797
+ unless status_code == 200 || status_code == 202 || status_code == 404
798
+ error_model = JSON.load(response_content)
799
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
800
+ end
801
+
802
+ # Create Result
803
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
804
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
805
+
806
+ result
807
+ end
808
+
809
+ promise.execute
810
+ end
811
+
488
812
  #
489
813
  # Gets all redis caches in a resource group.
490
814
  #
491
815
  # @param next_page_link [String] The NextLink from the previous successful
492
816
  # call to List operation.
493
- # @param [Hash{String => String}] The hash of custom headers need to be
494
- # applied to HTTP request.
817
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
818
+ # will be added to the HTTP request.
495
819
  #
496
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
497
- # response.
820
+ # @return [RedisListResult] operation results.
498
821
  #
499
822
  def list_by_resource_group_next(next_page_link, custom_headers = nil)
823
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
824
+ response.body unless response.nil?
825
+ end
826
+
827
+ #
828
+ # Gets all redis caches in a resource group.
829
+ #
830
+ # @param next_page_link [String] The NextLink from the previous successful
831
+ # call to List operation.
832
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
833
+ # will be added to the HTTP request.
834
+ #
835
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
836
+ #
837
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
838
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
839
+ end
840
+
841
+ #
842
+ # Gets all redis caches in a resource group.
843
+ #
844
+ # @param next_page_link [String] The NextLink from the previous successful
845
+ # call to List operation.
846
+ # @param [Hash{String => String}] A hash of custom headers that will be added
847
+ # to the HTTP request.
848
+ #
849
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
850
+ #
851
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
500
852
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
501
853
  request_headers = {}
502
854
 
@@ -509,7 +861,10 @@ module Azure::ARM::Redis
509
861
  skip_encoding_path_params: {'nextLink' => next_page_link},
510
862
  headers: request_headers.merge(custom_headers || {})
511
863
  }
512
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
864
+
865
+ request_url = @base_url || @client.base_url
866
+
867
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
513
868
  promise = request.run_promise do |req|
514
869
  @client.credentials.sign_request(req) unless @client.credentials.nil?
515
870
  end
@@ -549,13 +904,41 @@ module Azure::ARM::Redis
549
904
  #
550
905
  # @param next_page_link [String] The NextLink from the previous successful
551
906
  # call to List operation.
552
- # @param [Hash{String => String}] The hash of custom headers need to be
553
- # applied to HTTP request.
907
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
908
+ # will be added to the HTTP request.
554
909
  #
555
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
556
- # response.
910
+ # @return [RedisListResult] operation results.
557
911
  #
558
912
  def list_next(next_page_link, custom_headers = nil)
913
+ response = list_next_async(next_page_link, custom_headers).value!
914
+ response.body unless response.nil?
915
+ end
916
+
917
+ #
918
+ # Gets all redis caches in the specified subscription.
919
+ #
920
+ # @param next_page_link [String] The NextLink from the previous successful
921
+ # call to List operation.
922
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
923
+ # will be added to the HTTP request.
924
+ #
925
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
926
+ #
927
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
928
+ list_next_async(next_page_link, custom_headers).value!
929
+ end
930
+
931
+ #
932
+ # Gets all redis caches in the specified subscription.
933
+ #
934
+ # @param next_page_link [String] The NextLink from the previous successful
935
+ # call to List operation.
936
+ # @param [Hash{String => String}] A hash of custom headers that will be added
937
+ # to the HTTP request.
938
+ #
939
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
940
+ #
941
+ def list_next_async(next_page_link, custom_headers = nil)
559
942
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
560
943
  request_headers = {}
561
944
 
@@ -568,7 +951,10 @@ module Azure::ARM::Redis
568
951
  skip_encoding_path_params: {'nextLink' => next_page_link},
569
952
  headers: request_headers.merge(custom_headers || {})
570
953
  }
571
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
954
+
955
+ request_url = @base_url || @client.base_url
956
+
957
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
572
958
  promise = request.run_promise do |req|
573
959
  @client.credentials.sign_request(req) unless @client.credentials.nil?
574
960
  end