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