Class: Azure::StorageCache::Mgmt::V2019_11_01::Caches

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-11-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.

Parameters:

  • client

    service class for accessing basic functionality.



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

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientStorageCacheManagementClient (readonly)

Returns reference to the StorageCacheManagementClient.

Returns:



24
25
26
# File 'lib/2019-11-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.

new Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • cache (Cache) (defaults to: nil)

    Object containing the user-selectable properties of the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cache)

    operation results.



801
802
803
804
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 801

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.

new Cache. If read-only properties are included, they must match the existing values of those properties. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • cache (Cache) (defaults to: nil)

    Object containing the user-selectable properties of the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



836
837
838
839
840
841
842
843
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
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 836

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,31}$'" if !cache_name.nil? && cache_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).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::V2019_11_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::V2019_11_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::V2019_11_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.

new Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • cache (Cache) (defaults to: nil)

    Object containing the user-selectable properties of the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



819
820
821
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 819

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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



713
714
715
716
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 713

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.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



742
743
744
745
746
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
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 742

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,31}$'" if !cache_name.nil? && cache_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



728
729
730
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 728

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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



920
921
922
923
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 920

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.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



951
952
953
954
955
956
957
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
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 951

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,31}$'" if !cache_name.nil? && cache_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



936
937
938
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 936

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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



1007
1008
1009
1010
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1007

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.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
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
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1036

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,31}$'" if !cache_name.nil? && cache_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1022
1023
1024
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1022

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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



1092
1093
1094
1095
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1092

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.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
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
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1121

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,31}$'" if !cache_name.nil? && cache_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1107
1108
1109
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1107

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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



1178
1179
1180
1181
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1178

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.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
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
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1209

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,31}$'" if !cache_name.nil? && cache_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1194
1195
1196
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1194

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.

new Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • cache (Cache) (defaults to: nil)

    Object containing the user-selectable properties of the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cache)

    operation results.



359
360
361
362
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 359

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

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.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • cache (Cache) (defaults to: nil)

    Object containing the user-selectable properties of the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 376

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::V2019_11_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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



212
213
214
215
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 212

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/2019-11-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|
      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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



516
517
518
519
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 516

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 530

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

  promise
end

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

Returns a Cache.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cache)

    operation results.



261
262
263
264
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 261

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.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
339
340
341
342
343
344
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 290

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,31}$'" if !cache_name.nil? && cache_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).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::V2019_11_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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



276
277
278
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 276

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.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<Cache>)

    operation results.



34
35
36
37
# File 'lib/2019-11-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.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (CachesListResult)

    which provide lazy access to pages of the



1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1444

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.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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/2019-11-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::V2019_11_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.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<Cache>)

    operation results.



121
122
123
124
# File 'lib/2019-11-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.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (CachesListResult)

    which provide lazy access to pages of the



1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1465

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.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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/2019-11-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::V2019_11_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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (CachesListResult)

    operation results.



1355
1356
1357
1358
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1355

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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
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
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1384

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::V2019_11_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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1370
1371
1372
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1370

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.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



135
136
137
# File 'lib/2019-11-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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (CachesListResult)

    operation results.



1265
1266
1267
1268
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1265

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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
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
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1294

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::V2019_11_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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1280
1281
1282
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 1280

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.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



47
48
49
# File 'lib/2019-11-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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



565
566
567
568
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 565

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 579

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

  promise
end

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

Tells an Active Cache to transition to Stopped state.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



614
615
616
617
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 614

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 628

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

  promise
end

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

Update a Cache instance.

Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • cache (Cache) (defaults to: nil)

    Object containing the user-selectable properties of the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cache)

    operation results.



407
408
409
410
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 407

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.

Cache. If read-only properties are included, they must match the existing values of those properties. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • cache (Cache) (defaults to: nil)

    Object containing the user-selectable properties of the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
503
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 442

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,31}$'" if !cache_name.nil? && cache_name.match(Regexp.new('^^[-0-9a-zA-Z_]{1,31}$$')).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::V2019_11_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::V2019_11_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.

Cache. If read-only properties are included, they must match the existing values of those properties. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • cache (Cache) (defaults to: nil)

    Object containing the user-selectable properties of the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



425
426
427
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 425

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.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Object)

    operation results.



664
665
666
667
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 664

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Target resource group.

  • cache_name (String)

    Name of Cache.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
# File 'lib/2019-11-01/generated/azure_mgmt_storagecache/caches.rb', line 678

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

  promise
end