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