Class: Azure::StorageCache::Mgmt::V2019_08_01_preview::Caches

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-08-01-preview/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-08-01-preview/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-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 24

def client
  @client
end

Instance Method Details

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

Create/update a Cache instance.

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.



803
804
805
806
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 803

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

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

Create/update a Cache instance.

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.



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
908
909
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 838

def begin_create_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_08_01_preview::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_08_01_preview::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_08_01_preview::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_with_http_info(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create/update a Cache instance.

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.



821
822
823
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 821

def begin_create_with_http_info(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  begin_create_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.



715
716
717
718
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 715

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.



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
787
788
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 744

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.



730
731
732
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 730

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 StorageTarget(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.



922
923
924
925
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 922

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 StorageTarget(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.



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
996
997
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 953

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
      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 StorageTarget(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.



938
939
940
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 938

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.



1009
1010
1011
1012
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1009

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.



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
1081
1082
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1038

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



1024
1025
1026
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1024

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.



1094
1095
1096
1097
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1094

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.



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
1166
1167
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1123

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



1109
1110
1111
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1109

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

Tells a cache to upgrade its firmware.

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.



1179
1180
1181
1182
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1179

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

Tells a cache to upgrade its firmware.

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.



1208
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
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1208

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

Tells a cache to upgrade its firmware.

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-08-01-preview/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(resource_group_name, cache_name, cache: nil, custom_headers: nil) ⇒ Cache

Create/update a Cache instance.

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.



362
363
364
365
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 362

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

#create_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



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 379

def create_async(resource_group_name, cache_name, cache:nil, custom_headers:nil)
  # Send request
  promise = begin_create_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_08_01_preview::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.



215
216
217
218
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 215

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



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

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 StorageTarget(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.



519
520
521
522
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 519

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



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

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.



264
265
266
267
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 264

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

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

Returns a Cache.

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.



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
345
346
347
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 293

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



279
280
281
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 279

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-08-01-preview/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



1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1446

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-08-01-preview/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_08_01_preview::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 and subscription.

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.



122
123
124
125
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 122

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 and subscription.

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



1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1468

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 and subscription.

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.



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
201
202
203
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 151

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_08_01_preview::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 and 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.



1355
1356
1357
1358
# File 'lib/2019-08-01-preview/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 and 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.



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
1434
1435
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1386

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_08_01_preview::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 and 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.



1371
1372
1373
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1371

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 and subscription.

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.



137
138
139
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 137

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.



1264
1265
1266
1267
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1264

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.



1293
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
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1293

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



1279
1280
1281
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 1279

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-08-01-preview/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.



568
569
570
571
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 568

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



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

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.



617
618
619
620
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 617

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



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

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.

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.



410
411
412
413
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 410

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.

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.



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
504
505
506
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 445

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

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.



428
429
430
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 428

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

Tells a cache to upgrade its firmware.

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.



666
667
668
669
# File 'lib/2019-08-01-preview/generated/azure_mgmt_storagecache/caches.rb', line 666

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



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

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