azure_mgmt_storagecache 0.17.0 → 0.17.1

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