Class: Azure::ARM::CognitiveServices::Accounts

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/generated/azure_mgmt_cognitive_services/accounts.rb

Overview

Cognitive Services Management Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Accounts

Creates and initializes a new instance of the Accounts class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientCognitiveServicesManagementClient (readonly)

Returns reference to the CognitiveServicesManagementClient.

Returns:



22
23
24
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 22

def client
  @client
end

Instance Method Details

#create(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ CognitiveServicesAccount

Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It’s also the resource type for billing.

user’s subscription. to provide for the created account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • parameters (CognitiveServicesAccountCreateParameters)

    The parameters

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccount)

    operation results.



39
40
41
42
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 39

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

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

Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It’s also the resource type for billing.

user’s subscription. to provide for the created account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • parameters (CognitiveServicesAccountCreateParameters)

    The parameters

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 78

def create_async(resource_group_name, , parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .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::ARM::CognitiveServices::Models::CognitiveServicesAccountCreateParameters.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.CognitiveServices/accounts/{accountName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'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 MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccount.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::ARM::CognitiveServices::Models::CognitiveServicesAccount.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

#create_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It’s also the resource type for billing.

user’s subscription. to provide for the created account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • parameters (CognitiveServicesAccountCreateParameters)

    The parameters

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



59
60
61
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 59

def create_with_http_info(resource_group_name, , parameters, custom_headers = nil)
  create_async(resource_group_name, , parameters, custom_headers).value!
end

#delete(resource_group_name, account_name, custom_headers = nil) ⇒ Object

Deletes a Cognitive Services account from the resource group.

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

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

    A hash of custom headers that



286
287
288
289
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 286

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

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

Deletes a Cognitive Services account from the resource group.

user’s subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
352
353
354
355
356
357
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 317

def delete_async(resource_group_name, , custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .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.CognitiveServices/accounts/{accountName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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, account_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a Cognitive Services account from the resource group.

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



302
303
304
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 302

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

#get_properties(resource_group_name, account_name, custom_headers = nil) ⇒ CognitiveServicesAccount

Returns a Cognitive Services account specified by the parameters.

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccount)

    operation results.



370
371
372
373
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 370

def get_properties(resource_group_name, , custom_headers = nil)
  response = get_properties_async(resource_group_name, , custom_headers).value!
  response.body unless response.nil?
end

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

Returns a Cognitive Services account specified by the parameters.

user’s subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 401

def get_properties_async(resource_group_name, , custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .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.CognitiveServices/accounts/{accountName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'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 MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccount.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_properties_with_http_info(resource_group_name, account_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns a Cognitive Services account specified by the parameters.

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • 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/generated/azure_mgmt_cognitive_services/accounts.rb', line 386

def get_properties_with_http_info(resource_group_name, , custom_headers = nil)
  get_properties_async(resource_group_name, , custom_headers).value!
end

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

Returns all the resources of a particular type belonging to a subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<CognitiveServicesAccount>)

    operation results.



551
552
553
554
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 551

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

#list_as_lazy(custom_headers = nil) ⇒ CognitiveServicesAccountListResult

Returns all the resources of a particular type belonging to a subscription.

will be added to the HTTP request.

pages of the response.

Parameters:

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccountListResult)

    which provide lazy access to



1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 1136

def list_as_lazy(custom_headers = nil)
  response = list_async(custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers)
    end
    page
  end
end

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

Returns all the resources of a particular type belonging to a subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 576

def list_async(custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccountListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group(resource_group_name, custom_headers = nil) ⇒ Array<CognitiveServicesAccount>

Returns all the resources of a particular type belonging to a resource group

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Array<CognitiveServicesAccount>)

    operation results.



463
464
465
466
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 463

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

#list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil) ⇒ CognitiveServicesAccountListResult

Returns all the resources of a particular type belonging to a resource group

user’s subscription. will be added to the HTTP request.

pages of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccountListResult)

    which provide lazy access to



1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 1116

def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_next_async(next_page_link, custom_headers)
    end
    page
  end
end

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

Returns all the resources of a particular type belonging to a resource group

user’s subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
538
539
540
541
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 492

def list_by_resource_group_async(resource_group_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.CognitiveServices/accounts'

  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 MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccountListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_next(next_page_link, custom_headers = nil) ⇒ CognitiveServicesAccountListResult

Returns all the resources of a particular type belonging to a resource group

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccountListResult)

    operation results.



941
942
943
944
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 941

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

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

Returns all the resources of a particular type belonging to a resource group

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 970

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


  request_headers = {}

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccountListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns all the resources of a particular type belonging to a resource group

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



956
957
958
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 956

def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
  list_by_resource_group_next_async(next_page_link, custom_headers).value!
end

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

Returns all the resources of a particular type belonging to a resource group

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



478
479
480
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 478

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

#list_keys(resource_group_name, account_name, custom_headers = nil) ⇒ CognitiveServicesAccountKeys

Lists the account keys for the specified Cognitive Services account.

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccountKeys)

    operation results.



637
638
639
640
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 637

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

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

Lists the account keys for the specified Cognitive Services account.

user’s subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 668

def list_keys_async(resource_group_name, , custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .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.CognitiveServices/accounts/{accountName}/listKeys'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccountKeys.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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

Lists the account keys for the specified Cognitive Services account.

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



653
654
655
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 653

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

#list_next(next_page_link, custom_headers = nil) ⇒ CognitiveServicesAccountListResult

Returns all the resources of a particular type belonging to a subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccountListResult)

    operation results.



1028
1029
1030
1031
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 1028

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

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

Returns all the resources of a particular type belonging to a subscription.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 1057

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


  request_headers = {}

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccountListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns all the resources of a particular type belonging to a subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1043
1044
1045
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 1043

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

#list_skus(resource_group_name, account_name, custom_headers = nil) ⇒ CognitiveServicesAccountEnumerateSkusResult

List available SKUs for the requested Cognitive Services account

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccountEnumerateSkusResult)

    operation results.



848
849
850
851
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 848

def list_skus(resource_group_name, , custom_headers = nil)
  response = list_skus_async(resource_group_name, , custom_headers).value!
  response.body unless response.nil?
end

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

List available SKUs for the requested Cognitive Services account

user’s subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 879

def list_skus_async(resource_group_name, , custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .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.CognitiveServices/accounts/{accountName}/skus'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'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 MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccountEnumerateSkusResult.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_skus_with_http_info(resource_group_name, account_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

List available SKUs for the requested Cognitive Services account

user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



864
865
866
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 864

def list_skus_with_http_info(resource_group_name, , custom_headers = nil)
  list_skus_async(resource_group_name, , custom_headers).value!
end

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

Returns all the resources of a particular type belonging to a subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



564
565
566
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 564

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

#regenerate_key(resource_group_name, account_name, key_name, custom_headers = nil) ⇒ CognitiveServicesAccountKeys

Regenerates the specified account key for the specified Cognitive Services account.

user’s subscription. include: ‘Key1’, ‘Key2’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • key_name (KeyName)

    key name to generate (Key1|Key2). Possible values

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccountKeys)

    operation results.



734
735
736
737
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 734

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

#regenerate_key_async(resource_group_name, account_name, key_name, custom_headers = nil) ⇒ Concurrent::Promise

Regenerates the specified account key for the specified Cognitive Services account.

user’s subscription. include: ‘Key1’, ‘Key2’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • key_name (KeyName)

    key name to generate (Key1|Key2). Possible values

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 771

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

  parameters = RegenerateKeyParameters.new
  unless key_name.nil?
    parameters.key_name = key_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['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::ARM::CognitiveServices::Models::RegenerateKeyParameters.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.CognitiveServices/accounts/{accountName}/regenerateKey'

  request_url = @base_url || @client.base_url

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

    result
  end

  promise.execute
end

#regenerate_key_with_http_info(resource_group_name, account_name, key_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Regenerates the specified account key for the specified Cognitive Services account.

user’s subscription. include: ‘Key1’, ‘Key2’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • key_name (KeyName)

    key name to generate (Key1|Key2). Possible values

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



753
754
755
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 753

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

#update(resource_group_name, account_name, sku = nil, tags = nil, custom_headers = nil) ⇒ CognitiveServicesAccount

Updates a Cognitive Services account

user’s subscription. that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • sku (Sku) (defaults to: nil)

    Gets or sets the SKU of the resource.

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

    Gets or sets a list of key value pairs

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

    A hash of custom headers that

Returns:

  • (CognitiveServicesAccount)

    operation results.



167
168
169
170
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 167

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

#update_async(resource_group_name, account_name, sku = nil, tags = nil, custom_headers = nil) ⇒ Concurrent::Promise

Updates a Cognitive Services account

user’s subscription. that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • sku (Sku) (defaults to: nil)

    Gets or sets the SKU of the resource.

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

    Gets or sets a list of key value pairs

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 210

def update_async(resource_group_name, , sku = nil, tags = nil, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .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?

  parameters = CognitiveServicesAccountUpdateParameters.new
  unless sku.nil? && tags.nil?
    parameters.sku = sku
    parameters.tags = tags
  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['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccountUpdateParameters.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.CognitiveServices/accounts/{accountName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'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 MsRest::HttpOperationError.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::ARM::CognitiveServices::Models::CognitiveServicesAccount.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, account_name, sku = nil, tags = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a Cognitive Services account

user’s subscription. that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • account_name (String)

    The name of Cognitive Services account.

  • sku (Sku) (defaults to: nil)

    Gets or sets the SKU of the resource.

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

    Gets or sets a list of key value pairs

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



189
190
191
# File 'lib/generated/azure_mgmt_cognitive_services/accounts.rb', line 189

def update_with_http_info(resource_group_name, , sku = nil, tags = nil, custom_headers = nil)
  update_async(resource_group_name, , sku, tags, custom_headers).value!
end