Class: Azure::Redis::Mgmt::V2017_02_01::RedisLinkedServerOperations

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb

Overview

REST API for Azure Redis Cache Service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ RedisLinkedServerOperations

Creates and initializes a new instance of the RedisLinkedServerOperations class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.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/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 22

def client
  @client
end

Instance Method Details

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

Adds a linked server to the Redis cache (requires Premium SKU).

being added to the Redis cache. the Create Linked server 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.

  • linked_server_name (String)

    The name of the linked server that is

  • parameters (RedisLinkedServerCreateParameters)

    Parameters supplied to

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

    A hash of custom headers that

Returns:

  • (RedisLinkedServerWithProperties)

    operation results.



367
368
369
370
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 367

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

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

Adds a linked server to the Redis cache (requires Premium SKU).

being added to the Redis cache. the Create Linked server operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the Redis cache.

  • linked_server_name (String)

    The name of the linked server that is

  • parameters (RedisLinkedServerCreateParameters)

    Parameters supplied to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
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/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 404

def begin_create_async(resource_group_name, name, linked_server_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, 'linked_server_name is nil' if linked_server_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::V2017_02_01::Models::RedisLinkedServerCreateParameters.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}/linkedServers/{linkedServerName}'

  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,'linkedServerName' => linked_server_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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Redis::Mgmt::V2017_02_01::Models::RedisLinkedServerWithProperties.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::Redis::Mgmt::V2017_02_01::Models::RedisLinkedServerWithProperties.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, linked_server_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Adds a linked server to the Redis cache (requires Premium SKU).

being added to the Redis cache. the Create Linked server 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.

  • linked_server_name (String)

    The name of the linked server that is

  • parameters (RedisLinkedServerCreateParameters)

    Parameters supplied to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



386
387
388
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 386

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

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

Adds a linked server to the Redis cache (requires Premium SKU).

being added to the Redis cache. the Create Linked server 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.

  • linked_server_name (String)

    The name of the linked server that is

  • parameters (RedisLinkedServerCreateParameters)

    Parameters supplied to

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

    A hash of custom headers that

Returns:

  • (RedisLinkedServerWithProperties)

    operation results.



38
39
40
41
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 38

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

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

being added to the Redis cache. the Create Linked server 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.

  • linked_server_name (String)

    The name of the linked server that is

  • parameters (RedisLinkedServerCreateParameters)

    Parameters supplied to

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 56

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

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

Deletes the linked server from a redis cache (requires Premium SKU).

being added to the 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.

  • linked_server_name (String)

    The name of the linked server that is

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

    A hash of custom headers that



85
86
87
88
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 85

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

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

Deletes the linked server from a redis cache (requires Premium SKU).

being added to the 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.

  • linked_server_name (String)

    The name of the linked server that is

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 118

def delete_async(resource_group_name, name, linked_server_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, 'linked_server_name is nil' if linked_server_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}/linkedServers/{linkedServerName}'

  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,'linkedServerName' => linked_server_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
      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

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

Deletes the linked server from a redis cache (requires Premium SKU).

being added to the 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.

  • linked_server_name (String)

    The name of the linked server that is

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



102
103
104
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 102

def delete_with_http_info(resource_group_name, name, linked_server_name, custom_headers = nil)
  delete_async(resource_group_name, name, linked_server_name, custom_headers).value!
end

#get(resource_group_name, name, linked_server_name, custom_headers = nil) ⇒ RedisLinkedServerWithProperties

Gets the detailed information about a linked server of a redis cache (requires Premium SKU).

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.

  • linked_server_name (String)

    The name of the linked server.

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

    A hash of custom headers that

Returns:

  • (RedisLinkedServerWithProperties)

    operation results.



173
174
175
176
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 173

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

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

Gets the detailed information about a linked server of a redis cache (requires Premium SKU).

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • name (String)

    The name of the redis cache.

  • linked_server_name (String)

    The name of the linked server.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 206

def get_async(resource_group_name, name, linked_server_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, 'linked_server_name is nil' if linked_server_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}/linkedServers/{linkedServerName}'

  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,'linkedServerName' => linked_server_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::V2017_02_01::Models::RedisLinkedServerWithProperties.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, linked_server_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the detailed information about a linked server of a redis cache (requires Premium SKU).

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.

  • linked_server_name (String)

    The name of the linked server.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



190
191
192
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 190

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

#list(resource_group_name, name, custom_headers = nil) ⇒ RedisLinkedServerWithPropertiesList

Gets the list of linked servers associated with this redis cache (requires Premium SKU).

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:

  • (RedisLinkedServerWithPropertiesList)

    operation results.



270
271
272
273
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 270

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

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

Gets the list of linked servers associated with this redis cache (requires Premium SKU).

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.



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 301

def list_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}/linkedServers'

  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::V2017_02_01::Models::RedisLinkedServerWithPropertiesList.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_with_http_info(resource_group_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the list of linked servers associated with this redis cache (requires Premium SKU).

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.



286
287
288
# File 'lib/2017-02-01/generated/azure_mgmt_redis/redis_linked_server_operations.rb', line 286

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