Class: Azure::Redis::Mgmt::V2016_04_01::Redis

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-04-01/generated/azure_mgmt_redis/redis.rb

Overview

REST API for Azure Redis Cache Service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Redis

Creates and initializes a new instance of the Redis class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientRedisManagementClient (readonly)

Returns reference to the RedisManagementClient.

Returns:



22
23
24
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create(resource_group_name, name, parameters, custom_headers = nil) ⇒ RedisResource

Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.

Redis operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisCreateParameters)

    Parameters supplied to the Create

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

    A hash of custom headers that

Returns:

  • (RedisResource)

    operation results.



888
889
890
891
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 888

def begin_create(resource_group_name, name, parameters, custom_headers = nil)
  response = begin_create_async(resource_group_name, name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_create_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.

Redis operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisCreateParameters)

    Parameters supplied to the Create

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
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
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 923

def begin_create_async(resource_group_name, name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisCreateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
      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 == 201 || 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?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisResource.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 == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisResource.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, name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.

Redis operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisCreateParameters)

    Parameters supplied to the Create

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



906
907
908
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 906

def begin_create_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
  begin_create_async(resource_group_name, name, parameters, custom_headers).value!
end

#begin_delete(resource_group_name, name, custom_headers = nil) ⇒ Object

Deletes a Redis cache.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

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

    A hash of custom headers that



1004
1005
1006
1007
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1004

def begin_delete(resource_group_name, name, custom_headers = nil)
  response = begin_delete_async(resource_group_name, name, custom_headers).value!
  nil
end

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

Deletes a Redis cache.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1033
1034
1035
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
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1033

def begin_delete_async(resource_group_name, name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if 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 = {}

  # 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.Cache/Redis/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => 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 == 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
  end

  promise.execute
end

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

Deletes a Redis cache.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1019
1020
1021
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1019

def begin_delete_with_http_info(resource_group_name, name, custom_headers = nil)
  begin_delete_async(resource_group_name, name, custom_headers).value!
end

#begin_export_data(resource_group_name, name, parameters, custom_headers = nil) ⇒ Object

Export data from the redis cache to blobs in a container.

operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ExportRDBParameters)

    Parameters for Redis export

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

    A hash of custom headers that



1182
1183
1184
1185
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1182

def begin_export_data(resource_group_name, name, parameters, custom_headers = nil)
  response = begin_export_data_async(resource_group_name, name, parameters, custom_headers).value!
  nil
end

#begin_export_data_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Export data from the redis cache to blobs in a container.

operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ExportRDBParameters)

    Parameters for Redis export

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1215

def begin_export_data_async(resource_group_name, name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::ExportRDBParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
      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(: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 == 202 || status_code == 200 || 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
  end

  promise.execute
end

#begin_export_data_with_http_info(resource_group_name, name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Export data from the redis cache to blobs in a container.

operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ExportRDBParameters)

    Parameters for Redis export

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1199
1200
1201
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1199

def begin_export_data_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
  begin_export_data_async(resource_group_name, name, parameters, custom_headers).value!
end

#begin_import_data(resource_group_name, name, parameters, custom_headers = nil) ⇒ Object

Import data into Redis cache.

operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ImportRDBParameters)

    Parameters for Redis import

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

    A hash of custom headers that



1086
1087
1088
1089
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1086

def begin_import_data(resource_group_name, name, parameters, custom_headers = nil)
  response = begin_import_data_async(resource_group_name, name, parameters, custom_headers).value!
  nil
end

#begin_import_data_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Import data into Redis cache.

operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ImportRDBParameters)

    Parameters for Redis import

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1119
1120
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
1166
1167
1168
1169
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1119

def begin_import_data_async(resource_group_name, name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::ImportRDBParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
      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(: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 == 202 || status_code == 200 || 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
  end

  promise.execute
end

#begin_import_data_with_http_info(resource_group_name, name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Import data into Redis cache.

operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ImportRDBParameters)

    Parameters for Redis import

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1103
1104
1105
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1103

def begin_import_data_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
  begin_import_data_async(resource_group_name, name, parameters, custom_headers).value!
end

#create(resource_group_name, name, parameters, custom_headers = nil) ⇒ RedisResource

Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.

Redis operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisCreateParameters)

    Parameters supplied to the Create

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

    A hash of custom headers that

Returns:

  • (RedisResource)

    operation results.



37
38
39
40
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 37

def create(resource_group_name, name, parameters, custom_headers = nil)
  response = create_async(resource_group_name, name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#create_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Redis operation. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisCreateParameters)

    Parameters supplied to the Create

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 53

def create_async(resource_group_name, name, parameters, custom_headers = nil)
  # Send request
  promise = begin_create_async(resource_group_name, name, parameters, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisResource.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, name, custom_headers = nil) ⇒ Object

Deletes a Redis cache.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

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

    A hash of custom headers that



186
187
188
189
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 186

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis 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



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 200

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

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

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

  promise
end

#export_data(resource_group_name, name, parameters, custom_headers = nil) ⇒ Object

Export data from the redis cache to blobs in a container.

operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ExportRDBParameters)

    Parameters for Redis export

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

    A hash of custom headers that



843
844
845
846
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 843

def export_data(resource_group_name, name, parameters, custom_headers = nil)
  response = export_data_async(resource_group_name, name, parameters, custom_headers).value!
  nil
end

#export_data_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

operation. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ExportRDBParameters)

    Parameters for Redis export

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 859

def export_data_async(resource_group_name, name, parameters, custom_headers = nil)
  # Send request
  promise = begin_export_data_async(resource_group_name, name, parameters, custom_headers)

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

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

  promise
end

#force_reboot(resource_group_name, name, parameters, custom_headers = nil) ⇒ RedisForceRebootResponse

Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss.

reboot. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisRebootParameters)

    Specifies which Redis node(s) to

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

    A hash of custom headers that

Returns:

  • (RedisForceRebootResponse)

    operation results.



694
695
696
697
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 694

def force_reboot(resource_group_name, name, parameters, custom_headers = nil)
  response = force_reboot_async(resource_group_name, name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#force_reboot_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss.

reboot. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisRebootParameters)

    Specifies which Redis node(s) to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



729
730
731
732
733
734
735
736
737
738
739
740
741
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
787
788
789
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 729

def force_reboot_async(resource_group_name, name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisRebootParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
      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(: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
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisForceRebootResponse.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

#force_reboot_with_http_info(resource_group_name, name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss.

reboot. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisRebootParameters)

    Specifies which Redis node(s) to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



712
713
714
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 712

def force_reboot_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
  force_reboot_async(resource_group_name, name, parameters, custom_headers).value!
end

#get(resource_group_name, name, custom_headers = nil) ⇒ RedisResource

Gets a Redis cache (resource description).

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

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

    A hash of custom headers that

Returns:

  • (RedisResource)

    operation results.



226
227
228
229
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 226

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

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

Gets a Redis cache (resource description).

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 255

def get_async(resource_group_name, name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if 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 = {}

  # 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.Cache/Redis/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisResource.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, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a Redis cache (resource description).

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



241
242
243
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 241

def get_with_http_info(resource_group_name, name, custom_headers = nil)
  get_async(resource_group_name, name, custom_headers).value!
end

#import_data(resource_group_name, name, parameters, custom_headers = nil) ⇒ Object

Import data into Redis cache.

operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ImportRDBParameters)

    Parameters for Redis import

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

    A hash of custom headers that



801
802
803
804
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 801

def import_data(resource_group_name, name, parameters, custom_headers = nil)
  response = import_data_async(resource_group_name, name, parameters, custom_headers).value!
  nil
end

#import_data_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

operation. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (ImportRDBParameters)

    Parameters for Redis import

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 817

def import_data_async(resource_group_name, name, parameters, custom_headers = nil)
  # Send request
  promise = begin_import_data_async(resource_group_name, name, parameters, custom_headers)

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

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

  promise
end

#list(custom_headers = nil) ⇒ Array<RedisResource>

Gets all Redis caches in the specified 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<RedisResource>)

    operation results.



402
403
404
405
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 402

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

#list_as_lazy(custom_headers = nil) ⇒ RedisListResult

Gets all Redis caches in the specified subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (RedisListResult)

    which provide lazy access to pages of the response.



1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1469

def list_as_lazy(custom_headers = nil)
  response = list_async(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)
    end
    page
  end
end

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

Gets all Redis caches in the specified 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.



427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 427

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 = {}

  # 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.Cache/Redis/'

  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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisListResult.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<RedisResource>

Lists all Redis caches in a resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

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

    A hash of custom headers that

Returns:

  • (Array<RedisResource>)

    operation results.



316
317
318
319
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 316

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

#list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil) ⇒ RedisListResult

Lists all Redis caches in a resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

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

    A hash of custom headers that

Returns:

  • (RedisListResult)

    which provide lazy access to pages of the response.



1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1450

def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
  response = list_by_resource_group_async(resource_group_name, 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)
    end
    page
  end
end

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

Lists all Redis caches in a resource group.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 343

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 = {}

  # 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.Cache/Redis/'

  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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisListResult.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) ⇒ RedisListResult

Lists all Redis caches in 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:

  • (RedisListResult)

    operation results.



1277
1278
1279
1280
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1277

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

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

Lists all Redis caches in 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.



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
1344
1345
1346
1347
1348
1349
1350
1351
1352
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1306

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 = {}

  # 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisListResult.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

Lists all Redis caches in 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.



1292
1293
1294
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1292

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).value!
end

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

Lists all Redis caches in a resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



330
331
332
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 330

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

#list_keys(resource_group_name, name, custom_headers = nil) ⇒ RedisAccessKeys

Retrieve a Redis cache’s access keys. This operation requires write permission to the cache resource.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

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

    A hash of custom headers that

Returns:

  • (RedisAccessKeys)

    operation results.



488
489
490
491
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 488

def list_keys(resource_group_name, name, custom_headers = nil)
  response = list_keys_async(resource_group_name, name, custom_headers).value!
  response.body unless response.nil?
end

#list_keys_async(resource_group_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Retrieve a Redis cache’s access keys. This operation requires write permission to the cache resource.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 519

def list_keys_async(resource_group_name, name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if 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 = {}

  # 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.Cache/Redis/{name}/listKeys'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => 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(: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
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisAccessKeys.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_keys_with_http_info(resource_group_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieve a Redis cache’s access keys. This operation requires write permission to the cache resource.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



504
505
506
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 504

def list_keys_with_http_info(resource_group_name, name, custom_headers = nil)
  list_keys_async(resource_group_name, name, custom_headers).value!
end

#list_next(next_page_link, custom_headers = nil) ⇒ RedisListResult

Gets all Redis caches in the specified 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:

  • (RedisListResult)

    operation results.



1364
1365
1366
1367
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1364

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

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

Gets all Redis caches in the specified 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.



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
1436
1437
1438
1439
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1393

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


  request_headers = {}

  # 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisListResult.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

Gets all Redis caches in the specified 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.



1379
1380
1381
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 1379

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

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

Gets all Redis caches in the specified 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.



415
416
417
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 415

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

#regenerate_key(resource_group_name, name, parameters, custom_headers = nil) ⇒ RedisAccessKeys

Regenerate Redis cache’s access keys. This operation requires write permission to the cache resource.

regenerate. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisRegenerateKeyParameters)

    Specifies which key to

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

    A hash of custom headers that

Returns:

  • (RedisAccessKeys)

    operation results.



584
585
586
587
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 584

def regenerate_key(resource_group_name, name, parameters, custom_headers = nil)
  response = regenerate_key_async(resource_group_name, name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#regenerate_key_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Regenerate Redis cache’s access keys. This operation requires write permission to the cache resource.

regenerate. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisRegenerateKeyParameters)

    Specifies which key to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 619

def regenerate_key_async(resource_group_name, name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisRegenerateKeyParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
      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(: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
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisAccessKeys.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

#regenerate_key_with_http_info(resource_group_name, name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Regenerate Redis cache’s access keys. This operation requires write permission to the cache resource.

regenerate. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisRegenerateKeyParameters)

    Specifies which key to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



602
603
604
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 602

def regenerate_key_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
  regenerate_key_async(resource_group_name, name, parameters, custom_headers).value!
end

#update(resource_group_name, name, parameters, custom_headers = nil) ⇒ RedisResource

Update an existing Redis cache.

Redis operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisUpdateParameters)

    Parameters supplied to the Update

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

    A hash of custom headers that

Returns:

  • (RedisResource)

    operation results.



83
84
85
86
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 83

def update(resource_group_name, name, parameters, custom_headers = nil)
  response = update_async(resource_group_name, name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Update an existing Redis cache.

Redis operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisUpdateParameters)

    Parameters supplied to the Update

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 116

def update_async(resource_group_name, name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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 = {}

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

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

  # Serialize Request
  request_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2016_04_01::Models::RedisResource.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, name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Update an existing Redis cache.

Redis operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • parameters (RedisUpdateParameters)

    Parameters supplied to the Update

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



100
101
102
# File 'lib/2016-04-01/generated/azure_mgmt_redis/redis.rb', line 100

def update_with_http_info(resource_group_name, name, parameters, custom_headers = nil)
  update_async(resource_group_name, name, parameters, custom_headers).value!
end