Class: Azure::CognitiveServices::Mgmt::V2016_02_01_preview::CognitiveServicesAccounts
- Inherits:
-
Object
- Object
- Azure::CognitiveServices::Mgmt::V2016_02_01_preview::CognitiveServicesAccounts
- Includes:
- MsRestAzure
- Defined in:
- lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb
Overview
Cognitive Services Management Client
Instance Attribute Summary collapse
-
#client ⇒ CognitiveServicesManagementClient
readonly
Reference to the CognitiveServicesManagementClient.
Instance Method Summary collapse
-
#create(resource_group_name, account_name, parameters, custom_headers: nil) ⇒ CognitiveServicesAccount
Create Cognitive Services Account.
-
#create_async(resource_group_name, account_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise
Create Cognitive Services Account.
-
#create_with_http_info(resource_group_name, account_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Create Cognitive Services Account.
-
#delete(resource_group_name, account_name, custom_headers: nil) ⇒ Object
Deletes a Cognitive Services account from the resource group.
-
#delete_async(resource_group_name, account_name, custom_headers: nil) ⇒ Concurrent::Promise
Deletes a Cognitive Services account from the resource group.
-
#delete_with_http_info(resource_group_name, account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Deletes a Cognitive Services account from the resource group.
-
#get_properties(resource_group_name, account_name, custom_headers: nil) ⇒ CognitiveServicesAccount
Returns a Cognitive Services account specified by the parameters.
-
#get_properties_async(resource_group_name, account_name, custom_headers: nil) ⇒ Concurrent::Promise
Returns a Cognitive Services account specified by the parameters.
-
#get_properties_with_http_info(resource_group_name, account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Returns a Cognitive Services account specified by the parameters.
-
#initialize(client) ⇒ CognitiveServicesAccounts
constructor
Creates and initializes a new instance of the CognitiveServicesAccounts class.
-
#list(custom_headers: nil) ⇒ CognitiveServicesAccountListResult
Returns all the resources of a particular type belonging to a subscription.
-
#list_async(custom_headers: nil) ⇒ Concurrent::Promise
Returns all the resources of a particular type belonging to a subscription.
-
#list_by_resource_group(resource_group_name, custom_headers: nil) ⇒ CognitiveServicesAccountListResult
Returns all the resources of a particular type belonging to a resource group.
-
#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.
-
#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.
-
#list_keys(resource_group_name, account_name, custom_headers: nil) ⇒ CognitiveServicesAccountKeys
Lists the account keys for the specified Cognitive Services account.
-
#list_keys_async(resource_group_name, account_name, custom_headers: nil) ⇒ Concurrent::Promise
Lists the account keys for the specified Cognitive Services account.
-
#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.
-
#list_skus(resource_group_name, account_name, custom_headers: nil) ⇒ CognitiveServicesAccountEnumerateSkusResult
List available SKUs for the requested Cognitive Services account.
-
#list_skus_async(resource_group_name, account_name, custom_headers: nil) ⇒ Concurrent::Promise
List available SKUs for the requested Cognitive Services account.
-
#list_skus_with_http_info(resource_group_name, account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
List available SKUs for the requested Cognitive Services account.
-
#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Returns all the resources of a particular type belonging to a subscription.
-
#regenerate_key(resource_group_name, account_name, key_name: nil, custom_headers: nil) ⇒ CognitiveServicesAccountKeys
Regenerates the specified account key for the specified Cognitive Services account.
-
#regenerate_key_async(resource_group_name, account_name, key_name: nil, custom_headers: nil) ⇒ Concurrent::Promise
Regenerates the specified account key for the specified Cognitive Services account.
-
#regenerate_key_with_http_info(resource_group_name, account_name, key_name: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Regenerates the specified account key for the specified Cognitive Services account.
-
#update(resource_group_name, account_name, sku: nil, tags: nil, custom_headers: nil) ⇒ CognitiveServicesAccount
Updates a Cognitive Services account.
-
#update_async(resource_group_name, account_name, sku: nil, tags: nil, custom_headers: nil) ⇒ Concurrent::Promise
Updates a Cognitive Services account.
-
#update_with_http_info(resource_group_name, account_name, sku: nil, tags: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Updates a Cognitive Services account.
Constructor Details
#initialize(client) ⇒ CognitiveServicesAccounts
Creates and initializes a new instance of the CognitiveServicesAccounts class.
17 18 19 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 17 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ CognitiveServicesManagementClient (readonly)
Returns reference to the CognitiveServicesManagementClient.
22 23 24 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to provide for the created account. will be added to the HTTP request.
42 43 44 45 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 42 def create(resource_group_name, account_name, parameters, custom_headers:nil) response = create_async(resource_group_name, account_name, parameters, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to provide for the created account. to the HTTP request.
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 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 87 def create_async(resource_group_name, account_name, parameters, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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 = {} 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? # Serialize Request request_mapper = Azure::CognitiveServices::Mgmt::V2016_02_01_preview::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 = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::CognitiveServices::Mgmt::V2016_02_01_preview::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., 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::CognitiveServices::Mgmt::V2016_02_01_preview::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., 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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to provide for the created account. will be added to the HTTP request.
65 66 67 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 65 def create_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil) create_async(resource_group_name, account_name, parameters, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.
315 316 317 318 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 315 def delete(resource_group_name, account_name, custom_headers:nil) response = delete_async(resource_group_name, account_name, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to the HTTP request.
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 396 397 398 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 352 def delete_async(resource_group_name, account_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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 = {} 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? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_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, ) 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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.
334 335 336 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 334 def delete_with_http_info(resource_group_name, account_name, custom_headers:nil) delete_async(resource_group_name, account_name, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.
414 415 416 417 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 414 def get_properties(resource_group_name, account_name, custom_headers:nil) response = get_properties_async(resource_group_name, account_name, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to the HTTP request.
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 500 501 502 503 504 505 506 507 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 451 def get_properties_async(resource_group_name, account_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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 = {} 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? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::CognitiveServices::Mgmt::V2016_02_01_preview::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., 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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.
433 434 435 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 433 def get_properties_with_http_info(resource_group_name, account_name, custom_headers:nil) get_properties_async(resource_group_name, account_name, custom_headers:custom_headers).value! end |
#list(custom_headers: nil) ⇒ CognitiveServicesAccountListResult
Returns all the resources of a particular type belonging to a subscription.
will be added to the HTTP request.
610 611 612 613 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 610 def list(custom_headers:nil) response = list_async(custom_headers:custom_headers).value! response.body unless response.nil? end |
#list_async(custom_headers: nil) ⇒ Concurrent::Promise
Returns all the resources of a particular type belonging to a subscription.
to the HTTP request.
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 635 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 = {} 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? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts' request_url = @base_url || @client.base_url = { 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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::CognitiveServices::Mgmt::V2016_02_01_preview::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., e.backtrace, result) end end result end promise.execute end |
#list_by_resource_group(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.
519 520 521 522 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 519 def list_by_resource_group(resource_group_name, custom_headers:nil) response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value! response.body unless response.nil? 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.
548 549 550 551 552 553 554 555 556 557 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 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 548 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 = {} 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? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts' request_url = @base_url || @client.base_url = { 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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::CognitiveServices::Mgmt::V2016_02_01_preview::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., e.backtrace, result) end end result end promise.execute 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.
534 535 536 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 534 def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil) list_by_resource_group_async(resource_group_name, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.
702 703 704 705 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 702 def list_keys(resource_group_name, account_name, custom_headers:nil) response = list_keys_async(resource_group_name, account_name, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to the HTTP request.
739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 739 def list_keys_async(resource_group_name, account_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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 = {} 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? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::CognitiveServices::Mgmt::V2016_02_01_preview::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., 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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.
721 722 723 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 721 def list_keys_with_http_info(resource_group_name, account_name, custom_headers:nil) list_keys_async(resource_group_name, account_name, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.
940 941 942 943 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 940 def list_skus(resource_group_name, account_name, custom_headers:nil) response = list_skus_async(resource_group_name, account_name, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to the HTTP request.
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 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 977 def list_skus_async(resource_group_name, account_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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 = {} 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? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus' request_url = @base_url || @client.base_url = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::CognitiveServices::Mgmt::V2016_02_01_preview::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., 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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.
959 960 961 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 959 def list_skus_with_http_info(resource_group_name, account_name, custom_headers:nil) list_skus_async(resource_group_name, account_name, custom_headers: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.
623 624 625 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 623 def list_with_http_info(custom_headers:nil) list_async(custom_headers:custom_headers).value! end |
#regenerate_key(resource_group_name, account_name, key_name: nil, custom_headers: nil) ⇒ CognitiveServicesAccountKeys
Regenerates the specified account key for the specified Cognitive Services account.
user’s subscription. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. include: ‘Key1’, ‘Key2’ will be added to the HTTP request.
814 815 816 817 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 814 def regenerate_key(resource_group_name, account_name, key_name:nil, custom_headers:nil) response = regenerate_key_async(resource_group_name, account_name, key_name:key_name, custom_headers:custom_headers).value! response.body unless response.nil? end |
#regenerate_key_async(resource_group_name, account_name, key_name: nil, custom_headers: nil) ⇒ Concurrent::Promise
Regenerates the specified account key for the specified Cognitive Services account.
user’s subscription. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. include: ‘Key1’, ‘Key2’ to the HTTP request.
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 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 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 857 def regenerate_key_async(resource_group_name, account_name, key_name:nil, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'account_name is nil' if account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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? body = RegenerateKeyParameters.new unless key_name.nil? body.key_name = key_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? # Serialize Request request_mapper = Azure::CognitiveServices::Mgmt::V2016_02_01_preview::Models::RegenerateKeyParameters.mapper() request_content = @client.serialize(request_mapper, body) 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 = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::CognitiveServices::Mgmt::V2016_02_01_preview::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., e.backtrace, result) end end result end promise.execute end |
#regenerate_key_with_http_info(resource_group_name, account_name, key_name: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
Regenerates the specified account key for the specified Cognitive Services account.
user’s subscription. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. include: ‘Key1’, ‘Key2’ will be added to the HTTP request.
836 837 838 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 836 def regenerate_key_with_http_info(resource_group_name, account_name, key_name:nil, custom_headers:nil) regenerate_key_async(resource_group_name, account_name, key_name:key_name, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. 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.
183 184 185 186 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 183 def update(resource_group_name, account_name, sku:nil, tags:nil, custom_headers:nil) response = update_async(resource_group_name, account_name, sku:sku, tags:, custom_headers: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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. 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.
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 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 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 232 def update_async(resource_group_name, account_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 account_name.nil? fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24 fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3 fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).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? body = CognitiveServicesAccountUpdateParameters.new unless sku.nil? && .nil? body.sku = sku body. = 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? # Serialize Request request_mapper = Azure::CognitiveServices::Mgmt::V2016_02_01_preview::Models::CognitiveServicesAccountUpdateParameters.mapper() request_content = @client.serialize(request_mapper, body) 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 = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_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, ) 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? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::CognitiveServices::Mgmt::V2016_02_01_preview::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., 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. within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. 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.
208 209 210 |
# File 'lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb', line 208 def update_with_http_info(resource_group_name, account_name, sku:nil, tags:nil, custom_headers:nil) update_async(resource_group_name, account_name, sku:sku, tags:, custom_headers:custom_headers).value! end |