Class: Azure::Search::Mgmt::V2015_08_19::Services

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2015-08-19/generated/azure_mgmt_search/services.rb

Overview

Client that can be used to manage Azure Search services and API keys.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Services

Creates and initializes a new instance of the Services class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSearchManagementClient (readonly)

Returns reference to the SearchManagementClient.

Returns:



22
23
24
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, search_service_name, service, search_management_request_options: nil, custom_headers: nil) ⇒ SearchService

Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. or update. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service to

  • service (SearchService)

    The definition of the Search service to create

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

    A hash of custom headers that

Returns:

  • (SearchService)

    operation results.



688
689
690
691
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 688

def begin_create_or_update(resource_group_name, search_service_name, service, search_management_request_options:nil, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. or update. Additional parameters for the operation to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service to

  • service (SearchService)

    The definition of the Search service to create

  • search_management_request_options (SearchManagementRequestOptions) (defaults to: nil)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 745

def begin_create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'search_service_name is nil' if search_service_name.nil?
  fail ArgumentError, 'service is nil' if service.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?

  client_request_id = nil
  unless search_management_request_options.nil?
    client_request_id = search_management_request_options.clientRequestId
  end

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

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

  # Serialize Request
  request_mapper = Azure::Search::Mgmt::V2015_08_19::Models::SearchService.mapper()
  request_content = @client.serialize(request_mapper,  service)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'searchServiceName' => search_service_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::Search::Mgmt::V2015_08_19::Models::SearchService.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::Search::Mgmt::V2015_08_19::Models::SearchService.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_create_or_update_with_http_info(resource_group_name, search_service_name, service, search_management_request_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. or update. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service to

  • service (SearchService)

    The definition of the Search service to create

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



717
718
719
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 717

def begin_create_or_update_with_http_info(resource_group_name, search_service_name, service, search_management_request_options:nil, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
end

#check_name_availability(name, search_management_request_options: nil, custom_headers: nil) ⇒ CheckNameAvailabilityOutput

Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net).

names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • name (String)

    The Search service name to validate. Search service

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

    A hash of custom headers that

Returns:

  • (CheckNameAvailabilityOutput)

    operation results.



555
556
557
558
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 555

def check_name_availability(name, search_management_request_options:nil, custom_headers:nil)
  response = check_name_availability_async(name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#check_name_availability_async(name, search_management_request_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net).

names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Additional parameters for the operation to the HTTP request.

Parameters:

  • name (String)

    The Search service name to validate. Search service

  • search_management_request_options (SearchManagementRequestOptions) (defaults to: nil)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
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
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 596

def check_name_availability_async(name, search_management_request_options:nil, 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?
  fail ArgumentError, 'name is nil' if name.nil?

  client_request_id = nil
  check_name_availability_input = CheckNameAvailabilityInput.new
  unless search_management_request_options.nil?
    client_request_id = search_management_request_options.clientRequestId
  end
  unless name.nil?
    check_name_availability_input.name = name
  end

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

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

  # Serialize Request
  request_mapper = Azure::Search::Mgmt::V2015_08_19::Models::CheckNameAvailabilityInput.mapper()
  request_content = @client.serialize(request_mapper,  check_name_availability_input)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability'

  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},
      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::Search::Mgmt::V2015_08_19::Models::CheckNameAvailabilityOutput.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

#check_name_availability_with_http_info(name, search_management_request_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net).

names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • name (String)

    The Search service name to validate. Search service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



576
577
578
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 576

def check_name_availability_with_http_info(name, search_management_request_options:nil, custom_headers:nil)
  check_name_availability_async(name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, search_service_name, service, search_management_request_options: nil, custom_headers: nil) ⇒ SearchService

Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. or update. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service to

  • service (SearchService)

    The definition of the Search service to create

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

    A hash of custom headers that

Returns:

  • (SearchService)

    operation results.



48
49
50
51
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 48

def create_or_update(resource_group_name, search_service_name, service, search_management_request_options:nil, custom_headers:nil)
  response = create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. or update. Additional parameters for the operation will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service to

  • service (SearchService)

    The definition of the Search service to create

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 74

def create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options:nil, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options:search_management_request_options, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Search::Mgmt::V2015_08_19::Models::SearchService.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, search_service_name, search_management_request_options: nil, custom_headers: nil) ⇒ Object

Deletes a Search service in the given resource group, along with its associated resources.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. associated with the specified resource group. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service

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

    A hash of custom headers that



345
346
347
348
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 345

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

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

Deletes a Search service in the given resource group, along with its associated resources.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. associated with the specified resource group. Additional parameters for the operation to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service

  • search_management_request_options (SearchManagementRequestOptions) (defaults to: nil)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
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
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 386

def delete_async(resource_group_name, search_service_name, search_management_request_options:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'search_service_name is nil' if search_service_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?

  client_request_id = nil
  unless search_management_request_options.nil?
    client_request_id = search_management_request_options.clientRequestId
  end

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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  request_headers['x-ms-client-request-id'] = client_request_id.to_s unless client_request_id.to_s.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'searchServiceName' => search_service_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 || status_code == 404
      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, search_service_name, search_management_request_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a Search service in the given resource group, along with its associated resources.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. associated with the specified resource group. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



366
367
368
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 366

def delete_with_http_info(resource_group_name, search_service_name, search_management_request_options:nil, custom_headers:nil)
  delete_async(resource_group_name, search_service_name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
end

#get(resource_group_name, search_service_name, search_management_request_options: nil, custom_headers: nil) ⇒ SearchService

Gets the Search service with the given name in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. associated with the specified resource group. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service

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

    A hash of custom headers that

Returns:

  • (SearchService)

    operation results.



233
234
235
236
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 233

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

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

Gets the Search service with the given name in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. associated with the specified resource group. Additional parameters for the operation to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service

  • search_management_request_options (SearchManagementRequestOptions) (defaults to: nil)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 272

def get_async(resource_group_name, search_service_name, search_management_request_options:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'search_service_name is nil' if search_service_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?

  client_request_id = nil
  unless search_management_request_options.nil?
    client_request_id = search_management_request_options.clientRequestId
  end

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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  request_headers['x-ms-client-request-id'] = client_request_id.to_s unless client_request_id.to_s.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'searchServiceName' => search_service_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::Search::Mgmt::V2015_08_19::Models::SearchService.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, search_service_name, search_management_request_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the Search service with the given name in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. associated with the specified resource group. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



253
254
255
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 253

def get_with_http_info(resource_group_name, search_service_name, search_management_request_options:nil, custom_headers:nil)
  get_async(resource_group_name, search_service_name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
end

#list_by_resource_group(resource_group_name, search_management_request_options: nil, custom_headers: nil) ⇒ SearchServiceListResult

Gets a list of all Search services in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (SearchServiceListResult)

    operation results.



447
448
449
450
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 447

def list_by_resource_group(resource_group_name, search_management_request_options:nil, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Gets a list of all Search services in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Additional parameters for the operation to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_management_request_options (SearchManagementRequestOptions) (defaults to: nil)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 482

def list_by_resource_group_async(resource_group_name, search_management_request_options:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?

  client_request_id = nil
  unless search_management_request_options.nil?
    client_request_id = search_management_request_options.clientRequestId
  end

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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  request_headers['x-ms-client-request-id'] = client_request_id.to_s unless client_request_id.to_s.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices'

  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::Search::Mgmt::V2015_08_19::Models::SearchServiceListResult.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_with_http_info(resource_group_name, search_management_request_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of all Search services in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



465
466
467
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 465

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

#update(resource_group_name, search_service_name, service, search_management_request_options: nil, custom_headers: nil) ⇒ SearchService

Updates an existing Search service in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. update. update. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service to

  • service (SearchService)

    The definition of the Search service to

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

    A hash of custom headers that

Returns:

  • (SearchService)

    operation results.



109
110
111
112
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 109

def update(resource_group_name, search_service_name, service, search_management_request_options:nil, custom_headers:nil)
  response = update_async(resource_group_name, search_service_name, service, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, search_service_name, service, search_management_request_options: nil, custom_headers: nil) ⇒ Concurrent::Promise

Updates an existing Search service in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. update. update. Additional parameters for the operation to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service to

  • service (SearchService)

    The definition of the Search service to

  • search_management_request_options (SearchManagementRequestOptions) (defaults to: nil)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 152

def update_async(resource_group_name, search_service_name, service, search_management_request_options:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'search_service_name is nil' if search_service_name.nil?
  fail ArgumentError, 'service is nil' if service.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?

  client_request_id = nil
  unless search_management_request_options.nil?
    client_request_id = search_management_request_options.clientRequestId
  end

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

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

  # Serialize Request
  request_mapper = Azure::Search::Mgmt::V2015_08_19::Models::SearchService.mapper()
  request_content = @client.serialize(request_mapper,  service)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'searchServiceName' => search_service_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::Search::Mgmt::V2015_08_19::Models::SearchService.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, search_service_name, service, search_management_request_options: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates an existing Search service in the given resource group.

current subscription. You can obtain this value from the Azure Resource Manager API or the portal. update. update. Additional parameters for the operation will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • search_service_name (String)

    The name of the Azure Search service to

  • service (SearchService)

    The definition of the Search service to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



131
132
133
# File 'lib/2015-08-19/generated/azure_mgmt_search/services.rb', line 131

def update_with_http_info(resource_group_name, search_service_name, service, search_management_request_options:nil, custom_headers:nil)
  update_async(resource_group_name, search_service_name, service, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
end