Class: Azure::ARM::Search::Services

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



18
19
20
# File 'lib/generated/azure_mgmt_search/services.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSearchManagementClient (readonly)



23
24
25
# File 'lib/generated/azure_mgmt_search/services.rb', line 23

def client
  @client
end

Instance Method Details

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



517
518
519
520
# File 'lib/generated/azure_mgmt_search/services.rb', line 517

def check_name_availability(name, search_management_request_options = nil, custom_headers = nil)
  response = check_name_availability_async(name, search_management_request_options, 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.



558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
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
# File 'lib/generated/azure_mgmt_search/services.rb', line 558

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

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

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

  # Serialize Request
  request_mapper = CheckNameAvailabilityInput.mapper()
  request_content = @client.serialize(request_mapper,  check_name_availability_input, '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 = CheckNameAvailabilityOutput.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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.



538
539
540
# File 'lib/generated/azure_mgmt_search/services.rb', line 538

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



49
50
51
52
# File 'lib/generated/azure_mgmt_search/services.rb', line 49

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

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.



106
107
108
109
110
111
112
113
114
115
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
177
178
179
180
181
# File 'lib/generated/azure_mgmt_search/services.rb', line 106

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

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

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

  # Serialize Request
  request_mapper = SearchService.mapper()
  request_content = @client.serialize(request_mapper,  service, '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 = SearchService.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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 = SearchService.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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

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



78
79
80
# File 'lib/generated/azure_mgmt_search/services.rb', line 78

def create_or_update_with_http_info(resource_group_name, search_service_name, service, search_management_request_options = nil, custom_headers = nil)
  create_or_update_async(resource_group_name, search_service_name, service, search_management_request_options, custom_headers).value!
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.



309
310
311
312
# File 'lib/generated/azure_mgmt_search/services.rb', line 309

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



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
393
394
395
# File 'lib/generated/azure_mgmt_search/services.rb', line 350

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

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



330
331
332
# File 'lib/generated/azure_mgmt_search/services.rb', line 330

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



198
199
200
201
# File 'lib/generated/azure_mgmt_search/services.rb', line 198

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



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
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
# File 'lib/generated/azure_mgmt_search/services.rb', line 237

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

  # 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 = SearchService.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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.



218
219
220
# File 'lib/generated/azure_mgmt_search/services.rb', line 218

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



410
411
412
413
# File 'lib/generated/azure_mgmt_search/services.rb', line 410

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



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/generated/azure_mgmt_search/services.rb', line 445

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

  # 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 = SearchServiceListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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.



428
429
430
# File 'lib/generated/azure_mgmt_search/services.rb', line 428

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