azure_mgmt_storagecache 0.17.0 → 0.19.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2019-08-01-preview/generated/azure_mgmt_storagecache.rb +1 -2
  3. data/lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb +1 -1
  4. data/lib/2019-08-01-preview/generated/azure_mgmt_storagecache/operations.rb +1 -1
  5. data/lib/2019-08-01-preview/generated/azure_mgmt_storagecache/skus.rb +1 -1
  6. data/lib/2019-08-01-preview/generated/azure_mgmt_storagecache/{storage_cache_mgmt_client.rb → storage_cache_management_client.rb} +8 -4
  7. data/lib/2019-08-01-preview/generated/azure_mgmt_storagecache/storage_targets.rb +1 -1
  8. data/lib/2019-08-01-preview/generated/azure_mgmt_storagecache/usage_models.rb +1 -1
  9. data/lib/2019-11-01/generated/azure_mgmt_storagecache.rb +60 -0
  10. data/lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb +1477 -0
  11. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/api_operation.rb +59 -0
  12. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/api_operation_display.rb +69 -0
  13. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/api_operation_list_result.rb +101 -0
  14. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/cache.rb +188 -0
  15. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/cache_health.rb +60 -0
  16. data/lib/{2019-08-01-preview/generated/azure_mgmt_storagecache/models/cloud_error.rb → 2019-11-01/generated/azure_mgmt_storagecache/models/cache_sku.rb} +11 -12
  17. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/cache_upgrade_status.rb +101 -0
  18. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/caches_list_result.rb +100 -0
  19. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/clfs_target.rb +46 -0
  20. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/cloud_error_body.rb +92 -0
  21. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/firmware_status_type.rb +16 -0
  22. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/health_state_type.rb +23 -0
  23. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/namespace_junction.rb +68 -0
  24. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/nfs3target.rb +62 -0
  25. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/provisioning_state_type.rb +20 -0
  26. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/reason_code.rb +16 -0
  27. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/resource_sku.rb +143 -0
  28. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/resource_sku_capabilities.rb +57 -0
  29. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/resource_sku_location_info.rb +65 -0
  30. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/resource_skus_result.rb +100 -0
  31. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/restriction.rb +86 -0
  32. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/storage_target.rb +155 -0
  33. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/storage_target_type.rb +17 -0
  34. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/storage_targets_result.rb +99 -0
  35. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/unknown_target.rb +55 -0
  36. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/usage_model.rb +71 -0
  37. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/usage_model_display.rb +46 -0
  38. data/lib/2019-11-01/generated/azure_mgmt_storagecache/models/usage_models_result.rb +99 -0
  39. data/lib/2019-11-01/generated/azure_mgmt_storagecache/module_definition.rb +9 -0
  40. data/lib/2019-11-01/generated/azure_mgmt_storagecache/operations.rb +221 -0
  41. data/lib/2019-11-01/generated/azure_mgmt_storagecache/skus.rb +223 -0
  42. data/lib/2019-11-01/generated/azure_mgmt_storagecache/storage_cache_management_client.rb +153 -0
  43. data/lib/2019-11-01/generated/azure_mgmt_storagecache/storage_targets.rb +670 -0
  44. data/lib/2019-11-01/generated/azure_mgmt_storagecache/usage_models.rb +223 -0
  45. data/lib/2020-03-01/generated/azure_mgmt_storagecache.rb +72 -0
  46. data/lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb +1513 -0
  47. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/api_operation.rb +59 -0
  48. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/api_operation_display.rb +69 -0
  49. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/api_operation_list_result.rb +101 -0
  50. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache.rb +238 -0
  51. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache_encryption_settings.rb +48 -0
  52. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache_health.rb +60 -0
  53. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache_identity.rb +72 -0
  54. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache_identity_type.rb +16 -0
  55. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache_network_settings.rb +73 -0
  56. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache_security_settings.rb +46 -0
  57. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache_sku.rb +46 -0
  58. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cache_upgrade_status.rb +101 -0
  59. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/caches_list_result.rb +100 -0
  60. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/clfs_target.rb +46 -0
  61. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/clfs_target_properties.rb +110 -0
  62. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/cloud_error_body.rb +92 -0
  63. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/firmware_status_type.rb +16 -0
  64. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/health_state_type.rb +23 -0
  65. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/key_vault_key_reference.rb +59 -0
  66. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/key_vault_key_reference_source_vault.rb +46 -0
  67. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/namespace_junction.rb +68 -0
  68. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/nfs3target.rb +62 -0
  69. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/nfs3target_properties.rb +110 -0
  70. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/provisioning_state_type.rb +20 -0
  71. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/reason_code.rb +16 -0
  72. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/resource_sku.rb +143 -0
  73. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/resource_sku_capabilities.rb +57 -0
  74. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/resource_sku_location_info.rb +65 -0
  75. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/resource_skus_result.rb +100 -0
  76. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/restriction.rb +86 -0
  77. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/storage_target.rb +155 -0
  78. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/storage_target_properties.rb +130 -0
  79. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/storage_target_resource.rb +72 -0
  80. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/storage_target_type.rb +17 -0
  81. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/storage_targets_result.rb +99 -0
  82. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/unknown_target.rb +55 -0
  83. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/unknown_target_properties.rb +110 -0
  84. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/usage_model.rb +71 -0
  85. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/usage_model_display.rb +46 -0
  86. data/lib/2020-03-01/generated/azure_mgmt_storagecache/models/usage_models_result.rb +99 -0
  87. data/lib/2020-03-01/generated/azure_mgmt_storagecache/module_definition.rb +9 -0
  88. data/lib/2020-03-01/generated/azure_mgmt_storagecache/operations.rb +221 -0
  89. data/lib/2020-03-01/generated/azure_mgmt_storagecache/skus.rb +223 -0
  90. data/lib/2020-03-01/generated/azure_mgmt_storagecache/storage_cache_management_client.rb +153 -0
  91. data/lib/2020-03-01/generated/azure_mgmt_storagecache/storage_targets.rb +703 -0
  92. data/lib/2020-03-01/generated/azure_mgmt_storagecache/usage_models.rb +223 -0
  93. data/lib/2020-10-01/generated/azure_mgmt_storagecache.rb +92 -0
  94. data/lib/2020-10-01/generated/azure_mgmt_storagecache/asc_operations.rb +127 -0
  95. data/lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb +1580 -0
  96. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/api_operation.rb +95 -0
  97. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/api_operation_display.rb +80 -0
  98. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/api_operation_list_result.rb +101 -0
  99. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/api_operation_properties_service_specification.rb +57 -0
  100. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/asc_operation.rb +121 -0
  101. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache.rb +264 -0
  102. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_active_directory_settings.rb +124 -0
  103. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_active_directory_settings_credentials.rb +61 -0
  104. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_directory_settings.rb +62 -0
  105. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_encryption_settings.rb +48 -0
  106. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_health.rb +60 -0
  107. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_identity.rb +72 -0
  108. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_identity_type.rb +16 -0
  109. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_network_settings.rb +73 -0
  110. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_security_settings.rb +56 -0
  111. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_sku.rb +46 -0
  112. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_upgrade_status.rb +101 -0
  113. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_username_download_settings.rb +186 -0
  114. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cache_username_download_settings_credentials.rb +61 -0
  115. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/caches_list_result.rb +100 -0
  116. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/clfs_target.rb +46 -0
  117. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/clfs_target_properties.rb +102 -0
  118. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/cloud_error_body.rb +92 -0
  119. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/created_by_type.rb +18 -0
  120. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/domain_joined_type.rb +17 -0
  121. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/error_response.rb +57 -0
  122. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/firmware_status_type.rb +16 -0
  123. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/health_state_type.rb +23 -0
  124. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/key_vault_key_reference.rb +59 -0
  125. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/key_vault_key_reference_source_vault.rb +46 -0
  126. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/metric_aggregation_type.rb +21 -0
  127. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/metric_dimension.rb +79 -0
  128. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/metric_specification.rb +140 -0
  129. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/namespace_junction.rb +79 -0
  130. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/nfs3target.rb +62 -0
  131. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/nfs3target_properties.rb +102 -0
  132. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/nfs_access_policy.rb +69 -0
  133. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/nfs_access_rule.rb +139 -0
  134. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/nfs_access_rule_access.rb +17 -0
  135. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/nfs_access_rule_scope.rb +17 -0
  136. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/provisioning_state_type.rb +20 -0
  137. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/reason_code.rb +16 -0
  138. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/resource_sku.rb +143 -0
  139. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/resource_sku_capabilities.rb +57 -0
  140. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/resource_sku_location_info.rb +65 -0
  141. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/resource_skus_result.rb +100 -0
  142. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/restriction.rb +86 -0
  143. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/storage_target.rb +163 -0
  144. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/storage_target_properties.rb +119 -0
  145. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/storage_target_resource.rb +97 -0
  146. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/storage_targets_result.rb +99 -0
  147. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/system_data.rb +105 -0
  148. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/unknown_target.rb +55 -0
  149. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/unknown_target_properties.rb +102 -0
  150. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/usage_model.rb +71 -0
  151. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/usage_model_display.rb +46 -0
  152. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/usage_models_result.rb +99 -0
  153. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/username_downloaded_type.rb +17 -0
  154. data/lib/2020-10-01/generated/azure_mgmt_storagecache/models/username_source.rb +18 -0
  155. data/lib/2020-10-01/generated/azure_mgmt_storagecache/module_definition.rb +9 -0
  156. data/lib/2020-10-01/generated/azure_mgmt_storagecache/operations.rb +221 -0
  157. data/lib/2020-10-01/generated/azure_mgmt_storagecache/skus.rb +223 -0
  158. data/lib/2020-10-01/generated/azure_mgmt_storagecache/storage_cache_management_client.rb +157 -0
  159. data/lib/2020-10-01/generated/azure_mgmt_storagecache/storage_targets.rb +691 -0
  160. data/lib/2020-10-01/generated/azure_mgmt_storagecache/usage_models.rb +223 -0
  161. data/lib/azure_mgmt_storagecache.rb +3 -0
  162. data/lib/profiles/latest/modules/storagecache_profile_module.rb +208 -86
  163. data/lib/version.rb +1 -1
  164. metadata +158 -7
@@ -0,0 +1,153 @@
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 service client - single point of access to the REST API.
9
+ #
10
+ class StorageCacheManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials1
19
+
20
+ # @return [String] Subscription credentials which uniquely identify
21
+ # Microsoft Azure subscription. The subscription ID forms part of the URI
22
+ # for every service call.
23
+ attr_accessor :subscription_id
24
+
25
+ # @return [String] Client API version.
26
+ attr_reader :api_version
27
+
28
+ # @return Subscription credentials which uniquely identify client
29
+ # subscription.
30
+ attr_accessor :credentials
31
+
32
+ # @return [String] The preferred language for the response.
33
+ attr_accessor :accept_language
34
+
35
+ # @return [Integer] The retry timeout in seconds for Long Running
36
+ # Operations. Default value is 30.
37
+ attr_accessor :long_running_operation_retry_timeout
38
+
39
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
40
+ # generated. When set to true a unique x-ms-client-request-id value is
41
+ # generated and included in each request. Default is true.
42
+ attr_accessor :generate_client_request_id
43
+
44
+ # @return [Operations] operations
45
+ attr_reader :operations
46
+
47
+ # @return [Skus] skus
48
+ attr_reader :skus
49
+
50
+ # @return [UsageModels] usage_models
51
+ attr_reader :usage_models
52
+
53
+ # @return [Caches] caches
54
+ attr_reader :caches
55
+
56
+ # @return [StorageTargets] storage_targets
57
+ attr_reader :storage_targets
58
+
59
+ #
60
+ # Creates initializes a new instance of the StorageCacheManagementClient class.
61
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
62
+ # @param base_url [String] the base URI of the service.
63
+ # @param options [Array] filters to be applied to the HTTP requests.
64
+ #
65
+ def initialize(credentials = nil, base_url = nil, options = nil)
66
+ super(credentials, options)
67
+ @base_url = base_url || 'https://management.azure.com/'
68
+
69
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
70
+ @credentials = credentials
71
+
72
+ @operations = Operations.new(self)
73
+ @skus = Skus.new(self)
74
+ @usage_models = UsageModels.new(self)
75
+ @caches = Caches.new(self)
76
+ @storage_targets = StorageTargets.new(self)
77
+ @api_version = '2019-11-01'
78
+ @accept_language = 'en-US'
79
+ @long_running_operation_retry_timeout = 30
80
+ @generate_client_request_id = true
81
+ add_telemetry
82
+ end
83
+
84
+ #
85
+ # Makes a request and returns the body of the response.
86
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
87
+ # @param path [String] the path, relative to {base_url}.
88
+ # @param options [Hash{String=>String}] specifying any request options like :body.
89
+ # @return [Hash{String=>String}] containing the body of the response.
90
+ # Example:
91
+ #
92
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
93
+ # path = "/path"
94
+ # options = {
95
+ # body: request_content,
96
+ # query_params: {'api-version' => '2016-02-01'}
97
+ # }
98
+ # result = @client.make_request(:put, path, options)
99
+ #
100
+ def make_request(method, path, options = {})
101
+ result = make_request_with_http_info(method, path, options)
102
+ result.body unless result.nil?
103
+ end
104
+
105
+ #
106
+ # Makes a request and returns the operation response.
107
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
108
+ # @param path [String] the path, relative to {base_url}.
109
+ # @param options [Hash{String=>String}] specifying any request options like :body.
110
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
111
+ #
112
+ def make_request_with_http_info(method, path, options = {})
113
+ result = make_request_async(method, path, options).value!
114
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
115
+ result
116
+ end
117
+
118
+ #
119
+ # Makes a request asynchronously.
120
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
121
+ # @param path [String] the path, relative to {base_url}.
122
+ # @param options [Hash{String=>String}] specifying any request options like :body.
123
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
124
+ #
125
+ def make_request_async(method, path, options = {})
126
+ fail ArgumentError, 'method is nil' if method.nil?
127
+ fail ArgumentError, 'path is nil' if path.nil?
128
+
129
+ request_url = options[:base_url] || @base_url
130
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
131
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
132
+ end
133
+
134
+ request_headers = @request_headers
135
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
136
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
137
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
138
+
139
+ super(request_url, method, path, options)
140
+ end
141
+
142
+
143
+ private
144
+ #
145
+ # Adds telemetry information.
146
+ #
147
+ def add_telemetry
148
+ sdk_information = 'azure_mgmt_storagecache'
149
+ sdk_information = "#{sdk_information}/0.19.1"
150
+ add_user_agent_information(sdk_information)
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,670 @@
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 StorageTargets
13
+ include MsRestAzure
14
+
15
+ #
16
+ # Creates and initializes a new instance of the StorageTargets 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 a list of Storage Targets for the specified Cache.
28
+ #
29
+ # @param resource_group_name [String] Target resource group.
30
+ # @param cache_name [String] Name of Cache.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [Array<StorageTarget>] operation results.
35
+ #
36
+ def list_by_cache(resource_group_name, cache_name, custom_headers:nil)
37
+ first_page = list_by_cache_as_lazy(resource_group_name, cache_name, custom_headers:custom_headers)
38
+ first_page.get_all_items
39
+ end
40
+
41
+ #
42
+ # Returns a list of Storage Targets for the specified Cache.
43
+ #
44
+ # @param resource_group_name [String] Target resource group.
45
+ # @param cache_name [String] Name of Cache.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_by_cache_with_http_info(resource_group_name, cache_name, custom_headers:nil)
52
+ list_by_cache_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Returns a list of Storage Targets for the specified Cache.
57
+ #
58
+ # @param resource_group_name [String] Target resource group.
59
+ # @param cache_name [String] Name of Cache.
60
+ # @param [Hash{String => String}] A hash of custom headers that will be added
61
+ # to the HTTP request.
62
+ #
63
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
64
+ #
65
+ def list_by_cache_async(resource_group_name, cache_name, custom_headers:nil)
66
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+ fail ArgumentError, 'cache_name is nil' if cache_name.nil?
70
+ 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?
71
+
72
+
73
+ request_headers = {}
74
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
75
+
76
+ # Set Headers
77
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
78
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
79
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets'
80
+
81
+ request_url = @base_url || @client.base_url
82
+
83
+ options = {
84
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
85
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name},
86
+ query_params: {'api-version' => @client.api_version},
87
+ headers: request_headers.merge(custom_headers || {}),
88
+ base_url: request_url
89
+ }
90
+ promise = @client.make_request_async(:get, path_template, options)
91
+
92
+ promise = promise.then do |result|
93
+ http_response = result.response
94
+ status_code = http_response.status
95
+ response_content = http_response.body
96
+ unless status_code == 200
97
+ error_model = JSON.load(response_content)
98
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
99
+ end
100
+
101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
102
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
103
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
104
+ # Deserialize Response
105
+ if status_code == 200
106
+ begin
107
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
108
+ result_mapper = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTargetsResult.mapper()
109
+ result.body = @client.deserialize(result_mapper, parsed_response)
110
+ rescue Exception => e
111
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
112
+ end
113
+ end
114
+
115
+ result
116
+ end
117
+
118
+ promise.execute
119
+ end
120
+
121
+ #
122
+ # Removes a Storage Target from a Cache. This operation is allowed at any time,
123
+ # but if the Cache is down or unhealthy, the actual removal of the Storage
124
+ # Target may be delayed until the Cache is healthy again. Note that if the
125
+ # Cache has data to flush to the Storage Target, the data will be flushed
126
+ # before the Storage Target will be deleted.
127
+ #
128
+ # @param resource_group_name [String] Target resource group.
129
+ # @param cache_name [String] Name of Cache.
130
+ # @param storage_target_name [String] Name of Storage Target.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [Object] operation results.
135
+ #
136
+ def delete(resource_group_name, cache_name, storage_target_name, custom_headers:nil)
137
+ response = delete_async(resource_group_name, cache_name, storage_target_name, custom_headers:custom_headers).value!
138
+ response.body unless response.nil?
139
+ end
140
+
141
+ #
142
+ # @param resource_group_name [String] Target resource group.
143
+ # @param cache_name [String] Name of Cache.
144
+ # @param storage_target_name [String] Name of Storage Target.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [Concurrent::Promise] promise which provides async access to http
149
+ # response.
150
+ #
151
+ def delete_async(resource_group_name, cache_name, storage_target_name, custom_headers:nil)
152
+ # Send request
153
+ promise = begin_delete_async(resource_group_name, cache_name, storage_target_name, custom_headers:custom_headers)
154
+
155
+ promise = promise.then do |response|
156
+ # Defining deserialization method.
157
+ deserialize_method = lambda do |parsed_response|
158
+ result_mapper = {
159
+ client_side_validation: true,
160
+ required: false,
161
+ serialized_name: 'parsed_response',
162
+ type: {
163
+ name: 'Object'
164
+ }
165
+ }
166
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
167
+ end
168
+
169
+ # Waiting for response.
170
+ @client.get_long_running_operation_result(response, deserialize_method)
171
+ end
172
+
173
+ promise
174
+ end
175
+
176
+ #
177
+ # Returns a Storage Target from a Cache.
178
+ #
179
+ # @param resource_group_name [String] Target resource group.
180
+ # @param cache_name [String] Name of Cache.
181
+ # @param storage_target_name [String] Name of the Storage Target.
182
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
183
+ # will be added to the HTTP request.
184
+ #
185
+ # @return [StorageTarget] operation results.
186
+ #
187
+ def get(resource_group_name, cache_name, storage_target_name, custom_headers:nil)
188
+ response = get_async(resource_group_name, cache_name, storage_target_name, custom_headers:custom_headers).value!
189
+ response.body unless response.nil?
190
+ end
191
+
192
+ #
193
+ # Returns a Storage Target from a Cache.
194
+ #
195
+ # @param resource_group_name [String] Target resource group.
196
+ # @param cache_name [String] Name of Cache.
197
+ # @param storage_target_name [String] Name of the Storage Target.
198
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
199
+ # will be added to the HTTP request.
200
+ #
201
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
202
+ #
203
+ def get_with_http_info(resource_group_name, cache_name, storage_target_name, custom_headers:nil)
204
+ get_async(resource_group_name, cache_name, storage_target_name, custom_headers:custom_headers).value!
205
+ end
206
+
207
+ #
208
+ # Returns a Storage Target from a Cache.
209
+ #
210
+ # @param resource_group_name [String] Target resource group.
211
+ # @param cache_name [String] Name of Cache.
212
+ # @param storage_target_name [String] Name of the Storage Target.
213
+ # @param [Hash{String => String}] A hash of custom headers that will be added
214
+ # to the HTTP request.
215
+ #
216
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
217
+ #
218
+ def get_async(resource_group_name, cache_name, storage_target_name, custom_headers:nil)
219
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
220
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
221
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
222
+ fail ArgumentError, 'cache_name is nil' if cache_name.nil?
223
+ 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?
224
+ fail ArgumentError, 'storage_target_name is nil' if storage_target_name.nil?
225
+ fail ArgumentError, "'storage_target_name' should satisfy the constraint - 'Pattern': '^[-0-9a-zA-Z_]{1,31}$'" if !storage_target_name.nil? && storage_target_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).nil?
226
+
227
+
228
+ request_headers = {}
229
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
230
+
231
+ # Set Headers
232
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
233
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
234
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'
235
+
236
+ request_url = @base_url || @client.base_url
237
+
238
+ options = {
239
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
240
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name,'storageTargetName' => storage_target_name},
241
+ query_params: {'api-version' => @client.api_version},
242
+ headers: request_headers.merge(custom_headers || {}),
243
+ base_url: request_url
244
+ }
245
+ promise = @client.make_request_async(:get, path_template, options)
246
+
247
+ promise = promise.then do |result|
248
+ http_response = result.response
249
+ status_code = http_response.status
250
+ response_content = http_response.body
251
+ unless status_code == 200
252
+ error_model = JSON.load(response_content)
253
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
254
+ end
255
+
256
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
257
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
258
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
259
+ # Deserialize Response
260
+ if status_code == 200
261
+ begin
262
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
263
+ result_mapper = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTarget.mapper()
264
+ result.body = @client.deserialize(result_mapper, parsed_response)
265
+ rescue Exception => e
266
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
267
+ end
268
+ end
269
+
270
+ result
271
+ end
272
+
273
+ promise.execute
274
+ end
275
+
276
+ #
277
+ # Create or update a Storage Target. This operation is allowed at any time, but
278
+ # if the Cache is down or unhealthy, the actual creation/modification of the
279
+ # Storage Target may be delayed until the Cache is healthy again.
280
+ #
281
+ # @param resource_group_name [String] Target resource group.
282
+ # @param cache_name [String] Name of Cache.
283
+ # @param storage_target_name [String] Name of the Storage Target.
284
+ # @param storagetarget [StorageTarget] Object containing the definition of a
285
+ # Storage Target.
286
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
287
+ # will be added to the HTTP request.
288
+ #
289
+ # @return [StorageTarget] operation results.
290
+ #
291
+ def create_or_update(resource_group_name, cache_name, storage_target_name, storagetarget:nil, custom_headers:nil)
292
+ response = create_or_update_async(resource_group_name, cache_name, storage_target_name, storagetarget:storagetarget, custom_headers:custom_headers).value!
293
+ response.body unless response.nil?
294
+ end
295
+
296
+ #
297
+ # @param resource_group_name [String] Target resource group.
298
+ # @param cache_name [String] Name of Cache.
299
+ # @param storage_target_name [String] Name of the Storage Target.
300
+ # @param storagetarget [StorageTarget] Object containing the definition of a
301
+ # Storage Target.
302
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
303
+ # will be added to the HTTP request.
304
+ #
305
+ # @return [Concurrent::Promise] promise which provides async access to http
306
+ # response.
307
+ #
308
+ def create_or_update_async(resource_group_name, cache_name, storage_target_name, storagetarget:nil, custom_headers:nil)
309
+ # Send request
310
+ promise = begin_create_or_update_async(resource_group_name, cache_name, storage_target_name, storagetarget:storagetarget, custom_headers:custom_headers)
311
+
312
+ promise = promise.then do |response|
313
+ # Defining deserialization method.
314
+ deserialize_method = lambda do |parsed_response|
315
+ result_mapper = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTarget.mapper()
316
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
317
+ end
318
+
319
+ # Waiting for response.
320
+ @client.get_long_running_operation_result(response, deserialize_method)
321
+ end
322
+
323
+ promise
324
+ end
325
+
326
+ #
327
+ # Removes a Storage Target from a Cache. This operation is allowed at any time,
328
+ # but if the Cache is down or unhealthy, the actual removal of the Storage
329
+ # Target may be delayed until the Cache is healthy again. Note that if the
330
+ # Cache has data to flush to the Storage Target, the data will be flushed
331
+ # before the Storage Target will be deleted.
332
+ #
333
+ # @param resource_group_name [String] Target resource group.
334
+ # @param cache_name [String] Name of Cache.
335
+ # @param storage_target_name [String] Name of Storage Target.
336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
337
+ # will be added to the HTTP request.
338
+ #
339
+ # @return [Object] operation results.
340
+ #
341
+ def begin_delete(resource_group_name, cache_name, storage_target_name, custom_headers:nil)
342
+ response = begin_delete_async(resource_group_name, cache_name, storage_target_name, custom_headers:custom_headers).value!
343
+ response.body unless response.nil?
344
+ end
345
+
346
+ #
347
+ # Removes a Storage Target from a Cache. This operation is allowed at any time,
348
+ # but if the Cache is down or unhealthy, the actual removal of the Storage
349
+ # Target may be delayed until the Cache is healthy again. Note that if the
350
+ # Cache has data to flush to the Storage Target, the data will be flushed
351
+ # before the Storage Target will be deleted.
352
+ #
353
+ # @param resource_group_name [String] Target resource group.
354
+ # @param cache_name [String] Name of Cache.
355
+ # @param storage_target_name [String] Name of Storage Target.
356
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
357
+ # will be added to the HTTP request.
358
+ #
359
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
360
+ #
361
+ def begin_delete_with_http_info(resource_group_name, cache_name, storage_target_name, custom_headers:nil)
362
+ begin_delete_async(resource_group_name, cache_name, storage_target_name, custom_headers:custom_headers).value!
363
+ end
364
+
365
+ #
366
+ # Removes a Storage Target from a Cache. This operation is allowed at any time,
367
+ # but if the Cache is down or unhealthy, the actual removal of the Storage
368
+ # Target may be delayed until the Cache is healthy again. Note that if the
369
+ # Cache has data to flush to the Storage Target, the data will be flushed
370
+ # before the Storage Target will be deleted.
371
+ #
372
+ # @param resource_group_name [String] Target resource group.
373
+ # @param cache_name [String] Name of Cache.
374
+ # @param storage_target_name [String] Name of Storage Target.
375
+ # @param [Hash{String => String}] A hash of custom headers that will be added
376
+ # to the HTTP request.
377
+ #
378
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
379
+ #
380
+ def begin_delete_async(resource_group_name, cache_name, storage_target_name, custom_headers:nil)
381
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
382
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
383
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
384
+ fail ArgumentError, 'cache_name is nil' if cache_name.nil?
385
+ 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?
386
+ fail ArgumentError, 'storage_target_name is nil' if storage_target_name.nil?
387
+ fail ArgumentError, "'storage_target_name' should satisfy the constraint - 'Pattern': '^[-0-9a-zA-Z_]{1,31}$'" if !storage_target_name.nil? && storage_target_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).nil?
388
+
389
+
390
+ request_headers = {}
391
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
392
+
393
+ # Set Headers
394
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
395
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
396
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'
397
+
398
+ request_url = @base_url || @client.base_url
399
+
400
+ options = {
401
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
402
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name,'storageTargetName' => storage_target_name},
403
+ query_params: {'api-version' => @client.api_version},
404
+ headers: request_headers.merge(custom_headers || {}),
405
+ base_url: request_url
406
+ }
407
+ promise = @client.make_request_async(:delete, path_template, options)
408
+
409
+ promise = promise.then do |result|
410
+ http_response = result.response
411
+ status_code = http_response.status
412
+ response_content = http_response.body
413
+ unless status_code == 200 || status_code == 202 || status_code == 204
414
+ error_model = JSON.load(response_content)
415
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
416
+ end
417
+
418
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
419
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
420
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
421
+
422
+ result
423
+ end
424
+
425
+ promise.execute
426
+ end
427
+
428
+ #
429
+ # Create or update a Storage Target. This operation is allowed at any time, but
430
+ # if the Cache is down or unhealthy, the actual creation/modification of the
431
+ # Storage Target may be delayed until the Cache is healthy again.
432
+ #
433
+ # @param resource_group_name [String] Target resource group.
434
+ # @param cache_name [String] Name of Cache.
435
+ # @param storage_target_name [String] Name of the Storage Target.
436
+ # @param storagetarget [StorageTarget] Object containing the definition of a
437
+ # Storage Target.
438
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
439
+ # will be added to the HTTP request.
440
+ #
441
+ # @return [StorageTarget] operation results.
442
+ #
443
+ def begin_create_or_update(resource_group_name, cache_name, storage_target_name, storagetarget:nil, custom_headers:nil)
444
+ response = begin_create_or_update_async(resource_group_name, cache_name, storage_target_name, storagetarget:storagetarget, custom_headers:custom_headers).value!
445
+ response.body unless response.nil?
446
+ end
447
+
448
+ #
449
+ # Create or update a Storage Target. This operation is allowed at any time, but
450
+ # if the Cache is down or unhealthy, the actual creation/modification of the
451
+ # Storage Target may be delayed until the Cache is healthy again.
452
+ #
453
+ # @param resource_group_name [String] Target resource group.
454
+ # @param cache_name [String] Name of Cache.
455
+ # @param storage_target_name [String] Name of the Storage Target.
456
+ # @param storagetarget [StorageTarget] Object containing the definition of a
457
+ # Storage Target.
458
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
459
+ # will be added to the HTTP request.
460
+ #
461
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
462
+ #
463
+ def begin_create_or_update_with_http_info(resource_group_name, cache_name, storage_target_name, storagetarget:nil, custom_headers:nil)
464
+ begin_create_or_update_async(resource_group_name, cache_name, storage_target_name, storagetarget:storagetarget, custom_headers:custom_headers).value!
465
+ end
466
+
467
+ #
468
+ # Create or update a Storage Target. This operation is allowed at any time, but
469
+ # if the Cache is down or unhealthy, the actual creation/modification of the
470
+ # Storage Target may be delayed until the Cache is healthy again.
471
+ #
472
+ # @param resource_group_name [String] Target resource group.
473
+ # @param cache_name [String] Name of Cache.
474
+ # @param storage_target_name [String] Name of the Storage Target.
475
+ # @param storagetarget [StorageTarget] Object containing the definition of a
476
+ # Storage Target.
477
+ # @param [Hash{String => String}] A hash of custom headers that will be added
478
+ # to the HTTP request.
479
+ #
480
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
481
+ #
482
+ def begin_create_or_update_async(resource_group_name, cache_name, storage_target_name, storagetarget:nil, custom_headers:nil)
483
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
484
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
485
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
486
+ fail ArgumentError, 'cache_name is nil' if cache_name.nil?
487
+ 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?
488
+ fail ArgumentError, 'storage_target_name is nil' if storage_target_name.nil?
489
+ fail ArgumentError, "'storage_target_name' should satisfy the constraint - 'Pattern': '^[-0-9a-zA-Z_]{1,31}$'" if !storage_target_name.nil? && storage_target_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).nil?
490
+
491
+
492
+ request_headers = {}
493
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
494
+
495
+ # Set Headers
496
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
497
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
498
+
499
+ # Serialize Request
500
+ request_mapper = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTarget.mapper()
501
+ request_content = @client.serialize(request_mapper, storagetarget)
502
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
503
+
504
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'
505
+
506
+ request_url = @base_url || @client.base_url
507
+
508
+ options = {
509
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
510
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name,'storageTargetName' => storage_target_name},
511
+ query_params: {'api-version' => @client.api_version},
512
+ body: request_content,
513
+ headers: request_headers.merge(custom_headers || {}),
514
+ base_url: request_url
515
+ }
516
+ promise = @client.make_request_async(:put, path_template, options)
517
+
518
+ promise = promise.then do |result|
519
+ http_response = result.response
520
+ status_code = http_response.status
521
+ response_content = http_response.body
522
+ unless status_code == 200 || status_code == 201
523
+ error_model = JSON.load(response_content)
524
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
525
+ end
526
+
527
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
528
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
529
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
530
+ # Deserialize Response
531
+ if status_code == 200
532
+ begin
533
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
534
+ result_mapper = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTarget.mapper()
535
+ result.body = @client.deserialize(result_mapper, parsed_response)
536
+ rescue Exception => e
537
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
538
+ end
539
+ end
540
+ # Deserialize Response
541
+ if status_code == 201
542
+ begin
543
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
544
+ result_mapper = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTarget.mapper()
545
+ result.body = @client.deserialize(result_mapper, parsed_response)
546
+ rescue Exception => e
547
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
548
+ end
549
+ end
550
+
551
+ result
552
+ end
553
+
554
+ promise.execute
555
+ end
556
+
557
+ #
558
+ # Returns a list of Storage Targets for the specified Cache.
559
+ #
560
+ # @param next_page_link [String] The NextLink from the previous successful call
561
+ # to List operation.
562
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
563
+ # will be added to the HTTP request.
564
+ #
565
+ # @return [StorageTargetsResult] operation results.
566
+ #
567
+ def list_by_cache_next(next_page_link, custom_headers:nil)
568
+ response = list_by_cache_next_async(next_page_link, custom_headers:custom_headers).value!
569
+ response.body unless response.nil?
570
+ end
571
+
572
+ #
573
+ # Returns a list of Storage Targets for the specified Cache.
574
+ #
575
+ # @param next_page_link [String] The NextLink from the previous successful call
576
+ # to List operation.
577
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
578
+ # will be added to the HTTP request.
579
+ #
580
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
581
+ #
582
+ def list_by_cache_next_with_http_info(next_page_link, custom_headers:nil)
583
+ list_by_cache_next_async(next_page_link, custom_headers:custom_headers).value!
584
+ end
585
+
586
+ #
587
+ # Returns a list of Storage Targets for the specified Cache.
588
+ #
589
+ # @param next_page_link [String] The NextLink from the previous successful call
590
+ # to List operation.
591
+ # @param [Hash{String => String}] A hash of custom headers that will be added
592
+ # to the HTTP request.
593
+ #
594
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
595
+ #
596
+ def list_by_cache_next_async(next_page_link, custom_headers:nil)
597
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
598
+
599
+
600
+ request_headers = {}
601
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
602
+
603
+ # Set Headers
604
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
605
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
606
+ path_template = '{nextLink}'
607
+
608
+ request_url = @base_url || @client.base_url
609
+
610
+ options = {
611
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
612
+ skip_encoding_path_params: {'nextLink' => next_page_link},
613
+ headers: request_headers.merge(custom_headers || {}),
614
+ base_url: request_url
615
+ }
616
+ promise = @client.make_request_async(:get, path_template, options)
617
+
618
+ promise = promise.then do |result|
619
+ http_response = result.response
620
+ status_code = http_response.status
621
+ response_content = http_response.body
622
+ unless status_code == 200
623
+ error_model = JSON.load(response_content)
624
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
625
+ end
626
+
627
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
628
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
629
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
630
+ # Deserialize Response
631
+ if status_code == 200
632
+ begin
633
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
634
+ result_mapper = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTargetsResult.mapper()
635
+ result.body = @client.deserialize(result_mapper, parsed_response)
636
+ rescue Exception => e
637
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
638
+ end
639
+ end
640
+
641
+ result
642
+ end
643
+
644
+ promise.execute
645
+ end
646
+
647
+ #
648
+ # Returns a list of Storage Targets for the specified Cache.
649
+ #
650
+ # @param resource_group_name [String] Target resource group.
651
+ # @param cache_name [String] Name of Cache.
652
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
653
+ # will be added to the HTTP request.
654
+ #
655
+ # @return [StorageTargetsResult] which provide lazy access to pages of the
656
+ # response.
657
+ #
658
+ def list_by_cache_as_lazy(resource_group_name, cache_name, custom_headers:nil)
659
+ response = list_by_cache_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
660
+ unless response.nil?
661
+ page = response.body
662
+ page.next_method = Proc.new do |next_page_link|
663
+ list_by_cache_next_async(next_page_link, custom_headers:custom_headers)
664
+ end
665
+ page
666
+ end
667
+ end
668
+
669
+ end
670
+ end