azure_mgmt_storagecache 0.17.0 → 0.19.1

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