Class: Azure::Cosmosdb::Mgmt::V2020_03_01::TableResources

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



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

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientCosmosDBManagementClient (readonly)



22
23
24
# File 'lib/2020-03-01/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.



509
510
511
512
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 509

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.



546
547
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
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 546

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::V2020_03_01::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::V2020_03_01::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.



528
529
530
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 528

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.



629
630
631
632
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 629

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.



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
709
710
711
712
713
714
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 662

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.



646
647
648
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 646

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



730
731
732
733
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 730

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.



767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 767

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::V2020_03_01::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::V2020_03_01::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.



749
750
751
# File 'lib/2020-03-01/generated/azure_mgmt_cosmosdb/table_resources.rb', line 749

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.



255
256
257
258
# File 'lib/2020-03-01/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.



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/2020-03-01/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::V2020_03_01::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.



301
302
303
304
# File 'lib/2020-03-01/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.



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/2020-03-01/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.



142
143
144
145
# File 'lib/2020-03-01/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.



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/2020-03-01/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::V2020_03_01::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.



346
347
348
349
# File 'lib/2020-03-01/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.



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/2020-03-01/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::V2020_03_01::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.



364
365
366
# File 'lib/2020-03-01/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.



160
161
162
# File 'lib/2020-03-01/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.



35
36
37
38
# File 'lib/2020-03-01/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.



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/2020-03-01/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::V2020_03_01::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.



51
52
53
# File 'lib/2020-03-01/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

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



459
460
461
462
# File 'lib/2020-03-01/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.



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/2020-03-01/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::V2020_03_01::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