Class: Azure::Cosmosdb::Mgmt::V2021_01_15::TableResources

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb

Overview

Azure Cosmos DB Database Service Resource Provider REST API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ TableResources

Creates and initializes a new instance of the TableResources class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientCosmosDBManagementClient (readonly)

Returns reference to the CosmosDBManagementClient.

Returns:



22
23
24
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_update_table(resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers: nil) ⇒ TableGetResults

Create or update an Azure Cosmos DB Table

is case insensitive. parameters to provide for the current Table. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • create_update_table_parameters (TableCreateUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (TableGetResults)

    operation results.



601
602
603
604
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 601

def begin_create_update_table(resource_group_name, , table_name, create_update_table_parameters, custom_headers:nil)
  response = begin_create_update_table_async(resource_group_name, , table_name, create_update_table_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_update_table_async(resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers: nil) ⇒ Concurrent::Promise

Create or update an Azure Cosmos DB Table

is case insensitive. parameters to provide for the current Table. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • create_update_table_parameters (TableCreateUpdateParameters)

    The

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 638

def begin_create_update_table_async(resource_group_name, , table_name, create_update_table_parameters, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, 'table_name is nil' if table_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, 'create_update_table_parameters is nil' if create_update_table_parameters.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::Cosmosdb::Mgmt::V2021_01_15::Models::TableCreateUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  create_update_table_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => ,'tableName' => table_name},
      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 == 202 || status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.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::Cosmosdb::Mgmt::V2021_01_15::Models::TableGetResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_create_update_table_with_http_info(resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create or update an Azure Cosmos DB Table

is case insensitive. parameters to provide for the current Table. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • create_update_table_parameters (TableCreateUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



620
621
622
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 620

def begin_create_update_table_with_http_info(resource_group_name, , table_name, create_update_table_parameters, custom_headers:nil)
  begin_create_update_table_async(resource_group_name, , table_name, create_update_table_parameters, custom_headers:custom_headers).value!
end

#begin_delete_table(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Object

Deletes an existing Azure Cosmos DB Table.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that



721
722
723
724
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 721

def begin_delete_table(resource_group_name, , table_name, custom_headers:nil)
  response = begin_delete_table_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
  nil
end

#begin_delete_table_async(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes an existing Azure Cosmos DB Table.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 754

def begin_delete_table_async(resource_group_name, , table_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, 'table_name is nil' if table_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


  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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => ,'tableName' => table_name},
      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 == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.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

#begin_delete_table_with_http_info(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes an existing Azure Cosmos DB Table.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



738
739
740
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 738

def begin_delete_table_with_http_info(resource_group_name, , table_name, custom_headers:nil)
  begin_delete_table_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
end

#begin_migrate_table_to_autoscale(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ ThroughputSettingsGetResults

Migrate an Azure Cosmos DB Table from manual throughput to autoscale

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (ThroughputSettingsGetResults)

    operation results.



943
944
945
946
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 943

def begin_migrate_table_to_autoscale(resource_group_name, , table_name, custom_headers:nil)
  response = begin_migrate_table_to_autoscale_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_migrate_table_to_autoscale_async(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Concurrent::Promise

Migrate an Azure Cosmos DB Table from manual throughput to autoscale

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 976

def begin_migrate_table_to_autoscale_async(resource_group_name, , table_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, 'table_name is nil' if table_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


  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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => ,'tableName' => table_name},
      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 == 202 || 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::Cosmosdb::Mgmt::V2021_01_15::Models::ThroughputSettingsGetResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_migrate_table_to_autoscale_with_http_info(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Migrate an Azure Cosmos DB Table from manual throughput to autoscale

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



960
961
962
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 960

def begin_migrate_table_to_autoscale_with_http_info(resource_group_name, , table_name, custom_headers:nil)
  begin_migrate_table_to_autoscale_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
end

#begin_migrate_table_to_manual_throughput(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ ThroughputSettingsGetResults

Migrate an Azure Cosmos DB Table from autoscale to manual throughput

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (ThroughputSettingsGetResults)

    operation results.



1052
1053
1054
1055
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 1052

def begin_migrate_table_to_manual_throughput(resource_group_name, , table_name, custom_headers:nil)
  response = begin_migrate_table_to_manual_throughput_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_migrate_table_to_manual_throughput_async(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Concurrent::Promise

Migrate an Azure Cosmos DB Table from autoscale to manual throughput

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 1085

def begin_migrate_table_to_manual_throughput_async(resource_group_name, , table_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, 'table_name is nil' if table_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


  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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => ,'tableName' => table_name},
      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 == 202 || 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::Cosmosdb::Mgmt::V2021_01_15::Models::ThroughputSettingsGetResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_migrate_table_to_manual_throughput_with_http_info(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Migrate an Azure Cosmos DB Table from autoscale to manual throughput

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1069
1070
1071
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 1069

def begin_migrate_table_to_manual_throughput_with_http_info(resource_group_name, , table_name, custom_headers:nil)
  begin_migrate_table_to_manual_throughput_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
end

#begin_update_table_throughput(resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers: nil) ⇒ ThroughputSettingsGetResults

Update RUs per second of an Azure Cosmos DB Table

is case insensitive. parameters to provide for the RUs per second of the current Table. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • update_throughput_parameters (ThroughputSettingsUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (ThroughputSettingsGetResults)

    operation results.



822
823
824
825
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 822

def begin_update_table_throughput(resource_group_name, , table_name, update_throughput_parameters, custom_headers:nil)
  response = begin_update_table_throughput_async(resource_group_name, , table_name, update_throughput_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_update_table_throughput_async(resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers: nil) ⇒ Concurrent::Promise

Update RUs per second of an Azure Cosmos DB Table

is case insensitive. parameters to provide for the RUs per second of the current Table. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • update_throughput_parameters (ThroughputSettingsUpdateParameters)

    The

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
925
926
927
928
929
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 859

def begin_update_table_throughput_async(resource_group_name, , table_name, update_throughput_parameters, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, 'table_name is nil' if table_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, 'update_throughput_parameters is nil' if update_throughput_parameters.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::Cosmosdb::Mgmt::V2021_01_15::Models::ThroughputSettingsUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  update_throughput_parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => ,'tableName' => table_name},
      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 == 202 || status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.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::Cosmosdb::Mgmt::V2021_01_15::Models::ThroughputSettingsGetResults.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_update_table_throughput_with_http_info(resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update RUs per second of an Azure Cosmos DB Table

is case insensitive. parameters to provide for the RUs per second of the current Table. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • update_throughput_parameters (ThroughputSettingsUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



841
842
843
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 841

def begin_update_table_throughput_with_http_info(resource_group_name, , table_name, update_throughput_parameters, custom_headers:nil)
  begin_update_table_throughput_async(resource_group_name, , table_name, update_throughput_parameters, custom_headers:custom_headers).value!
end

#create_update_table(resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers: nil) ⇒ TableGetResults

Create or update an Azure Cosmos DB Table

is case insensitive. parameters to provide for the current Table. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • create_update_table_parameters (TableCreateUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (TableGetResults)

    operation results.



255
256
257
258
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 255

def create_update_table(resource_group_name, , table_name, create_update_table_parameters, custom_headers:nil)
  response = create_update_table_async(resource_group_name, , table_name, create_update_table_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_update_table_async(resource_group_name, account_name, table_name, create_update_table_parameters, custom_headers: nil) ⇒ Concurrent::Promise

is case insensitive. parameters to provide for the current Table. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • create_update_table_parameters (TableCreateUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 273

def create_update_table_async(resource_group_name, , table_name, create_update_table_parameters, custom_headers:nil)
  # Send request
  promise = begin_create_update_table_async(resource_group_name, , table_name, create_update_table_parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Cosmosdb::Mgmt::V2021_01_15::Models::TableGetResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete_table(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Object

Deletes an existing Azure Cosmos DB Table.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that



301
302
303
304
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 301

def delete_table(resource_group_name, , table_name, custom_headers:nil)
  response = delete_table_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
  nil
end

#delete_table_async(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Concurrent::Promise

is case insensitive. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 317

def delete_table_async(resource_group_name, , table_name, custom_headers:nil)
  # Send request
  promise = begin_delete_table_async(resource_group_name, , table_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#get_table(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ TableGetResults

Gets the Tables under an existing Azure Cosmos DB database account with the provided name.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (TableGetResults)

    operation results.



142
143
144
145
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 142

def get_table(resource_group_name, , table_name, custom_headers:nil)
  response = get_table_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_table_async(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the Tables under an existing Azure Cosmos DB database account with the provided name.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 177

def get_table_async(resource_group_name, , table_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, 'table_name is nil' if table_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


  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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    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::Cosmosdb::Mgmt::V2021_01_15::Models::TableGetResults.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_table_throughput(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ ThroughputSettingsGetResults

Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (ThroughputSettingsGetResults)

    operation results.



346
347
348
349
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 346

def get_table_throughput(resource_group_name, , table_name, custom_headers:nil)
  response = get_table_throughput_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_table_throughput_async(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 381

def get_table_throughput_async(resource_group_name, , table_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, 'table_name is nil' if table_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


  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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    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::Cosmosdb::Mgmt::V2021_01_15::Models::ThroughputSettingsGetResults.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_table_throughput_with_http_info(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



364
365
366
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 364

def get_table_throughput_with_http_info(resource_group_name, , table_name, custom_headers:nil)
  get_table_throughput_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
end

#get_table_with_http_info(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the Tables under an existing Azure Cosmos DB database account with the provided name.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



160
161
162
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 160

def get_table_with_http_info(resource_group_name, , table_name, custom_headers:nil)
  get_table_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
end

#list_tables(resource_group_name, account_name, custom_headers: nil) ⇒ TableListResult

Lists the Tables under an existing Azure Cosmos DB database account.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (TableListResult)

    operation results.



35
36
37
38
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 35

def list_tables(resource_group_name, , custom_headers:nil)
  response = list_tables_async(resource_group_name, , custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Lists the Tables under an existing Azure Cosmos DB database account.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



66
67
68
69
70
71
72
73
74
75
76
77
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
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 66

def list_tables_async(resource_group_name, , custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !.nil? && .length > 50
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !.nil? && .length < 3
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !.nil? && .match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1


  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.DocumentDB/databaseAccounts/{accountName}/tables'

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    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::Cosmosdb::Mgmt::V2021_01_15::Models::TableListResult.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_tables_with_http_info(resource_group_name, account_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the Tables under an existing Azure Cosmos DB database account.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



51
52
53
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 51

def list_tables_with_http_info(resource_group_name, , custom_headers:nil)
  list_tables_async(resource_group_name, , custom_headers:custom_headers).value!
end

#migrate_table_to_autoscale(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ ThroughputSettingsGetResults

Migrate an Azure Cosmos DB Table from manual throughput to autoscale

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (ThroughputSettingsGetResults)

    operation results.



507
508
509
510
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 507

def migrate_table_to_autoscale(resource_group_name, , table_name, custom_headers:nil)
  response = migrate_table_to_autoscale_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#migrate_table_to_autoscale_async(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Concurrent::Promise

is case insensitive. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 523

def migrate_table_to_autoscale_async(resource_group_name, , table_name, custom_headers:nil)
  # Send request
  promise = begin_migrate_table_to_autoscale_async(resource_group_name, , table_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Cosmosdb::Mgmt::V2021_01_15::Models::ThroughputSettingsGetResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#migrate_table_to_manual_throughput(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ ThroughputSettingsGetResults

Migrate an Azure Cosmos DB Table from autoscale to manual throughput

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (ThroughputSettingsGetResults)

    operation results.



553
554
555
556
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 553

def migrate_table_to_manual_throughput(resource_group_name, , table_name, custom_headers:nil)
  response = migrate_table_to_manual_throughput_async(resource_group_name, , table_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#migrate_table_to_manual_throughput_async(resource_group_name, account_name, table_name, custom_headers: nil) ⇒ Concurrent::Promise

is case insensitive. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 569

def migrate_table_to_manual_throughput_async(resource_group_name, , table_name, custom_headers:nil)
  # Send request
  promise = begin_migrate_table_to_manual_throughput_async(resource_group_name, , table_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Cosmosdb::Mgmt::V2021_01_15::Models::ThroughputSettingsGetResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#update_table_throughput(resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers: nil) ⇒ ThroughputSettingsGetResults

Update RUs per second of an Azure Cosmos DB Table

is case insensitive. parameters to provide for the RUs per second of the current Table. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • update_throughput_parameters (ThroughputSettingsUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (ThroughputSettingsGetResults)

    operation results.



459
460
461
462
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 459

def update_table_throughput(resource_group_name, , table_name, update_throughput_parameters, custom_headers:nil)
  response = update_table_throughput_async(resource_group_name, , table_name, update_throughput_parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_table_throughput_async(resource_group_name, account_name, table_name, update_throughput_parameters, custom_headers: nil) ⇒ Concurrent::Promise

is case insensitive. parameters to provide for the RUs per second of the current Table. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • account_name (String)

    Cosmos DB database account name.

  • table_name (String)

    Cosmos DB table name.

  • update_throughput_parameters (ThroughputSettingsUpdateParameters)

    The

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/2021-01-15/generated/azure_mgmt_cosmosdb/table_resources.rb', line 477

def update_table_throughput_async(resource_group_name, , table_name, update_throughput_parameters, custom_headers:nil)
  # Send request
  promise = begin_update_table_throughput_async(resource_group_name, , table_name, update_throughput_parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Cosmosdb::Mgmt::V2021_01_15::Models::ThroughputSettingsGetResults.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end