azure_mgmt_storagecache 0.17.1 → 0.18.0

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