Class: Azure::StorageCache::Mgmt::V2020_03_01::Caches

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb

Overview

A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as “Storage Targets”). These operations allow you to manage Caches.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Caches

Creates and initializes a new instance of the Caches class.



19
20
21
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 19

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientStorageCacheManagementClient (readonly)



24
25
26
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 24

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ Cache

Create or update a Cache.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. new Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.



823
824
825
826
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 823

def begin_create_or_update(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, cache_name, cache:cache, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ Concurrent::Promise

Create or update a Cache.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. new Cache. If read-only properties are included, they must match the existing values of those properties. to the HTTP request.



860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 860

def begin_create_or_update_async(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'cache_name is nil' if cache_name.nil?
  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?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::Cache.mapper()
  request_content = @client.serialize(request_mapper,  cache)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 201
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::Cache.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::Cache.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_create_or_update_with_http_info(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create or update a Cache.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. new Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.



842
843
844
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 842

def begin_create_or_update_with_http_info(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, cache_name, cache:cache, custom_headers:custom_headers).value!
end

#begin_delete(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Schedules a Cache for deletion.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



732
733
734
735
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 732

def begin_delete(resource_group_name, cache_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_delete_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

Schedules a Cache for deletion.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. to the HTTP request.



763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 763

def begin_delete_async(resource_group_name, cache_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cache_name is nil' if cache_name.nil?
  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?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'cacheName' => cache_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_delete_with_http_info(resource_group_name, cache_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Schedules a Cache for deletion.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



748
749
750
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 748

def begin_delete_with_http_info(resource_group_name, cache_name, custom_headers:nil)
  begin_delete_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
end

#begin_flush(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



945
946
947
948
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 945

def begin_flush(resource_group_name, cache_name, custom_headers:nil)
  response = begin_flush_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_flush_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. to the HTTP request.



978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 978

def begin_flush_async(resource_group_name, cache_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'cache_name is nil' if cache_name.nil?
  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?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_flush_with_http_info(resource_group_name, cache_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



962
963
964
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 962

def begin_flush_with_http_info(resource_group_name, cache_name, custom_headers:nil)
  begin_flush_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
end

#begin_start(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Tells a Stopped state Cache to transition to Active state.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1035
1036
1037
1038
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1035

def begin_start(resource_group_name, cache_name, custom_headers:nil)
  response = begin_start_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_start_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

Tells a Stopped state Cache to transition to Active state.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. to the HTTP request.



1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1066

def begin_start_async(resource_group_name, cache_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'cache_name is nil' if cache_name.nil?
  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?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_start_with_http_info(resource_group_name, cache_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Tells a Stopped state Cache to transition to Active state.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1051
1052
1053
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1051

def begin_start_with_http_info(resource_group_name, cache_name, custom_headers:nil)
  begin_start_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
end

#begin_stop(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Tells an Active Cache to transition to Stopped state.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1123
1124
1125
1126
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1123

def begin_stop(resource_group_name, cache_name, custom_headers:nil)
  response = begin_stop_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_stop_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

Tells an Active Cache to transition to Stopped state.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. to the HTTP request.



1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1154

def begin_stop_async(resource_group_name, cache_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'cache_name is nil' if cache_name.nil?
  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?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_stop_with_http_info(resource_group_name, cache_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Tells an Active Cache to transition to Stopped state.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1139
1140
1141
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1139

def begin_stop_with_http_info(resource_group_name, cache_name, custom_headers:nil)
  begin_stop_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
end

#begin_upgrade_firmware(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Upgrade a Cache’s firmware if a new version is available. Otherwise, this operation has no effect.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1212
1213
1214
1215
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1212

def begin_upgrade_firmware(resource_group_name, cache_name, custom_headers:nil)
  response = begin_upgrade_firmware_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_upgrade_firmware_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

Upgrade a Cache’s firmware if a new version is available. Otherwise, this operation has no effect.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. to the HTTP request.



1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1245

def begin_upgrade_firmware_async(resource_group_name, cache_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'cache_name is nil' if cache_name.nil?
  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?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201 || status_code == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_upgrade_firmware_with_http_info(resource_group_name, cache_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Upgrade a Cache’s firmware if a new version is available. Otherwise, this operation has no effect.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1229
1230
1231
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1229

def begin_upgrade_firmware_with_http_info(resource_group_name, cache_name, custom_headers:nil)
  begin_upgrade_firmware_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ Cache

Create or update a Cache.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. new Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.



365
366
367
368
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 365

def create_or_update(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  response = create_or_update_async(resource_group_name, cache_name, cache:cache, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ Concurrent::Promise

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. new Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.

response.



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 383

def create_or_update_async(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, cache_name, cache:cache, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::Cache.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Schedules a Cache for deletion.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



213
214
215
216
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 213

def delete(resource_group_name, cache_name, custom_headers:nil)
  response = delete_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#delete_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.

response.



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 228

def delete_async(resource_group_name, cache_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, cache_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = {
        client_side_validation: true,
        required: false,
        serialized_name: 'parsed_response',
        type: {
          name: 'Object'
        }
      }
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#flush(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



527
528
529
530
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 527

def flush(resource_group_name, cache_name, custom_headers:nil)
  response = flush_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#flush_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.

response.



542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 542

def flush_async(resource_group_name, cache_name, custom_headers:nil)
  # Send request
  promise = begin_flush_async(resource_group_name, cache_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = {
        client_side_validation: true,
        required: false,
        serialized_name: 'parsed_response',
        type: {
          name: 'Object'
        }
      }
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::AZURE_ASYNC_OPERATION)
  end

  promise
end

#get(resource_group_name, cache_name, custom_headers: nil) ⇒ Cache

Returns a Cache.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



264
265
266
267
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 264

def get(resource_group_name, cache_name, custom_headers:nil)
  response = get_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

Returns a Cache.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. to the HTTP request.



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 295

def get_async(resource_group_name, cache_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cache_name is nil' if cache_name.nil?
  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?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'cacheName' => cache_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::Cache.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_with_http_info(resource_group_name, cache_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns a Cache.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



280
281
282
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 280

def get_with_http_info(resource_group_name, cache_name, custom_headers:nil)
  get_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
end

#list(custom_headers: nil) ⇒ Array<Cache>

Returns all Caches the user has access to under a subscription.

will be added to the HTTP request.



34
35
36
37
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 34

def list(custom_headers:nil)
  first_page = list_as_lazy(custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(custom_headers: nil) ⇒ CachesListResult

Returns all Caches the user has access to under a subscription.

will be added to the HTTP request.

response.



1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1480

def list_as_lazy(custom_headers:nil)
  response = list_async(custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_async(custom_headers: nil) ⇒ Concurrent::Promise

Returns all Caches the user has access to under a subscription.

to the HTTP request.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 59

def list_async(custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::CachesListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group(resource_group_name, custom_headers: nil) ⇒ Array<Cache>

Returns all Caches the user has access to under a resource group.

will be added to the HTTP request.



121
122
123
124
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 121

def list_by_resource_group(resource_group_name, custom_headers:nil)
  first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_as_lazy(resource_group_name, custom_headers: nil) ⇒ CachesListResult

Returns all Caches the user has access to under a resource group.

will be added to the HTTP request.

response.



1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1501

def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Returns all Caches the user has access to under a resource group.

to the HTTP request.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 148

def list_by_resource_group_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::CachesListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_next(next_page_link, custom_headers: nil) ⇒ CachesListResult

Returns all Caches the user has access to under a resource group.

to List operation. will be added to the HTTP request.



1391
1392
1393
1394
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1391

def list_by_resource_group_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Returns all Caches the user has access to under a resource group.

to List operation. to the HTTP request.



1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1420

def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::CachesListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns all Caches the user has access to under a resource group.

to List operation. will be added to the HTTP request.



1406
1407
1408
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1406

def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns all Caches the user has access to under a resource group.

will be added to the HTTP request.



135
136
137
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 135

def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end

#list_next(next_page_link, custom_headers: nil) ⇒ CachesListResult

Returns all Caches the user has access to under a subscription.

to List operation. will be added to the HTTP request.



1301
1302
1303
1304
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1301

def list_next(next_page_link, custom_headers:nil)
  response = list_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Returns all Caches the user has access to under a subscription.

to List operation. to the HTTP request.



1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1330

def list_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::CachesListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns all Caches the user has access to under a subscription.

to List operation. will be added to the HTTP request.



1316
1317
1318
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 1316

def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns all Caches the user has access to under a subscription.

will be added to the HTTP request.



47
48
49
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 47

def list_with_http_info(custom_headers:nil)
  list_async(custom_headers:custom_headers).value!
end

#start(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Tells a Stopped state Cache to transition to Active state.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



578
579
580
581
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 578

def start(resource_group_name, cache_name, custom_headers:nil)
  response = start_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#start_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.

response.



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 593

def start_async(resource_group_name, cache_name, custom_headers:nil)
  # Send request
  promise = begin_start_async(resource_group_name, cache_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = {
        client_side_validation: true,
        required: false,
        serialized_name: 'parsed_response',
        type: {
          name: 'Object'
        }
      }
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::AZURE_ASYNC_OPERATION)
  end

  promise
end

#stop(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Tells an Active Cache to transition to Stopped state.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



629
630
631
632
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 629

def stop(resource_group_name, cache_name, custom_headers:nil)
  response = stop_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#stop_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.

response.



644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 644

def stop_async(resource_group_name, cache_name, custom_headers:nil)
  # Send request
  promise = begin_stop_async(resource_group_name, cache_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = {
        client_side_validation: true,
        required: false,
        serialized_name: 'parsed_response',
        type: {
          name: 'Object'
        }
      }
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::AZURE_ASYNC_OPERATION)
  end

  promise
end

#update(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ Cache

Update a Cache instance.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.



415
416
417
418
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 415

def update(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  response = update_async(resource_group_name, cache_name, cache:cache, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ Concurrent::Promise

Update a Cache instance.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. Cache. If read-only properties are included, they must match the existing values of those properties. to the HTTP request.



452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 452

def update_async(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'cache_name is nil' if cache_name.nil?
  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?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::Cache.mapper()
  request_content = @client.serialize(request_mapper,  cache)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'cacheName' => cache_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::StorageCache::Mgmt::V2020_03_01::Models::Cache.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#update_with_http_info(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update a Cache instance.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.



434
435
436
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 434

def update_with_http_info(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  update_async(resource_group_name, cache_name, cache:cache, custom_headers:custom_headers).value!
end

#upgrade_firmware(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Upgrade a Cache’s firmware if a new version is available. Otherwise, this operation has no effect.

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.



681
682
683
684
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 681

def upgrade_firmware(resource_group_name, cache_name, custom_headers:nil)
  response = upgrade_firmware_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#upgrade_firmware_async(resource_group_name, cache_name, custom_headers: nil) ⇒ Concurrent::Promise

than 80 and chars must be in list of [-0-9a-zA-Z_] char class. will be added to the HTTP request.

response.



696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
# File 'lib/2020-03-01/generated/azure_mgmt_storagecache/caches.rb', line 696

def upgrade_firmware_async(resource_group_name, cache_name, custom_headers:nil)
  # Send request
  promise = begin_upgrade_firmware_async(resource_group_name, cache_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = {
        client_side_validation: true,
        required: false,
        serialized_name: 'parsed_response',
        type: {
          name: 'Object'
        }
      }
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::AZURE_ASYNC_OPERATION)
  end

  promise
end