Class: Azure::StorageCache::Mgmt::V2020_10_01::Caches

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2020-10-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-10-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-10-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 from the [-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.



807
808
809
810
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 807

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 from the [-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.



844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 844

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_10_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 || status_code == 202
      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_10_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_10_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 from the [-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.



826
827
828
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 826

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_debug_info(resource_group_name, cache_name, custom_headers: nil) ⇒ Object

Tells a Cache to write generate debug info for support to process.

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



927
928
929
930
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 927

def begin_debug_info(resource_group_name, cache_name, custom_headers:nil)
  response = begin_debug_info_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  nil
end

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

Tells a Cache to write generate debug info for support to process.

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



958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 958

def begin_debug_info_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}/debugInfo'

  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_debug_info_with_http_info(resource_group_name, cache_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Tells a Cache to write generate debug info for support to process.

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



943
944
945
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 943

def begin_debug_info_with_http_info(resource_group_name, cache_name, custom_headers:nil)
  begin_debug_info_async(resource_group_name, cache_name, 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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



716
717
718
719
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 716

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!
  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 from the [-0-9a-zA-Z_] char class. to the HTTP request.



747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 747

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



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

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1015
1016
1017
1018
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1015

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!
  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 from the [-0-9a-zA-Z_] char class. to the HTTP request.



1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1048

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1032
1033
1034
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1032

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1104
1105
1106
1107
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1104

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!
  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 from the [-0-9a-zA-Z_] char class. to the HTTP request.



1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1135

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1120
1121
1122
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1120

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1191
1192
1193
1194
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1191

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!
  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 from the [-0-9a-zA-Z_] char class. to the HTTP request.



1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1222

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1207
1208
1209
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1207

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1279
1280
1281
1282
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1279

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!
  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 from the [-0-9a-zA-Z_] char class. to the HTTP request.



1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1312

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



1296
1297
1298
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1296

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 from the [-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.



354
355
356
357
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 354

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 from the [-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.



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 372

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_10_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

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

Tells a Cache to write generate debug info for support to process.

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



513
514
515
516
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 513

def debug_info(resource_group_name, cache_name, custom_headers:nil)
  response = debug_info_async(resource_group_name, cache_name, custom_headers:custom_headers).value!
  nil
end

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

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

response.



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 528

def debug_info_async(resource_group_name, cache_name, custom_headers:nil)
  # Send request
  promise = begin_debug_info_async(resource_group_name, cache_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

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

  promise
end

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

Schedules a Cache for deletion.

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



211
212
213
214
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 211

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

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

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

response.



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 226

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|
    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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



554
555
556
557
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 554

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

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

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

response.



569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 569

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|
    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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



253
254
255
256
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 253

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 from the [-0-9a-zA-Z_] char class. to the HTTP request.



284
285
286
287
288
289
290
291
292
293
294
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 284

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_10_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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



269
270
271
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 269

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-10-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.



1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1547

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-10-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_10_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-10-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.



1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1568

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-10-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_10_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.



1458
1459
1460
1461
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1458

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.



1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1487

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_10_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.



1473
1474
1475
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1473

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-10-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.



1368
1369
1370
1371
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1368

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.



1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1397

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_10_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.



1383
1384
1385
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 1383

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-10-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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



594
595
596
597
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 594

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

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

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

response.



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 609

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|
    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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



634
635
636
637
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 634

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

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

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

response.



649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 649

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|
    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 from the [-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.



404
405
406
407
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 404

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 from the [-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.



441
442
443
444
445
446
447
448
449
450
451
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
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 441

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_10_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_10_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 from the [-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.



423
424
425
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 423

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 from the [-0-9a-zA-Z_] char class. will be added to the HTTP request.



675
676
677
678
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 675

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!
  nil
end

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

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

response.



690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
# File 'lib/2020-10-01/generated/azure_mgmt_storagecache/caches.rb', line 690

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|
    end

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

  promise
end