azure_mgmt_cosmosdb 0.21.2 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/cosmos_db.rb +1 -1
  3. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/cosmos_dbmanagement_client.rb +1 -1
  4. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/cosmos_dbmanagement_client.rb +1 -1
  5. data/lib/2019-12-12/generated/azure_mgmt_cosmosdb/cosmos_dbmanagement_client.rb +1 -1
  6. data/lib/2020-03-01/generated/azure_mgmt_cosmosdb/cosmos_dbmanagement_client.rb +1 -1
  7. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb.rb +28 -27
  8. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/cassandra_resources.rb +708 -60
  9. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/cosmos_dbmanagement_client.rb +1 -1
  10. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/gremlin_resources.rb +700 -60
  11. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/models/cors_policy.rb +99 -0
  12. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/models/database_account_create_update_parameters.rb +21 -0
  13. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/models/database_account_get_results.rb +21 -0
  14. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/models/database_account_update_parameters.rb +21 -0
  15. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/models/sql_container_get_properties_resource.rb +11 -0
  16. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/models/sql_container_resource.rb +11 -0
  17. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/mongo_dbresources.rb +711 -63
  18. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/sql_resources.rb +692 -60
  19. data/lib/2020-04-01/generated/azure_mgmt_cosmosdb/table_resources.rb +310 -0
  20. data/lib/version.rb +1 -1
  21. metadata +3 -2
@@ -494,6 +494,98 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
494
494
  promise
495
495
  end
496
496
 
497
+ #
498
+ # Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale
499
+ #
500
+ # @param resource_group_name [String] The name of the resource group. The name
501
+ # is case insensitive.
502
+ # @param account_name [String] Cosmos DB database account name.
503
+ # @param database_name [String] Cosmos DB database name.
504
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
505
+ # will be added to the HTTP request.
506
+ #
507
+ # @return [ThroughputSettingsGetResults] operation results.
508
+ #
509
+ def migrate_sql_database_to_autoscale(resource_group_name, account_name, database_name, custom_headers:nil)
510
+ response = migrate_sql_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
511
+ response.body unless response.nil?
512
+ end
513
+
514
+ #
515
+ # @param resource_group_name [String] The name of the resource group. The name
516
+ # is case insensitive.
517
+ # @param account_name [String] Cosmos DB database account name.
518
+ # @param database_name [String] Cosmos DB database name.
519
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
520
+ # will be added to the HTTP request.
521
+ #
522
+ # @return [Concurrent::Promise] promise which provides async access to http
523
+ # response.
524
+ #
525
+ def migrate_sql_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:nil)
526
+ # Send request
527
+ promise = begin_migrate_sql_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers)
528
+
529
+ promise = promise.then do |response|
530
+ # Defining deserialization method.
531
+ deserialize_method = lambda do |parsed_response|
532
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
533
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
534
+ end
535
+
536
+ # Waiting for response.
537
+ @client.get_long_running_operation_result(response, deserialize_method)
538
+ end
539
+
540
+ promise
541
+ end
542
+
543
+ #
544
+ # Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput
545
+ #
546
+ # @param resource_group_name [String] The name of the resource group. The name
547
+ # is case insensitive.
548
+ # @param account_name [String] Cosmos DB database account name.
549
+ # @param database_name [String] Cosmos DB database name.
550
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
551
+ # will be added to the HTTP request.
552
+ #
553
+ # @return [ThroughputSettingsGetResults] operation results.
554
+ #
555
+ def migrate_sql_database_to_manual_throughput(resource_group_name, account_name, database_name, custom_headers:nil)
556
+ response = migrate_sql_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
557
+ response.body unless response.nil?
558
+ end
559
+
560
+ #
561
+ # @param resource_group_name [String] The name of the resource group. The name
562
+ # is case insensitive.
563
+ # @param account_name [String] Cosmos DB database account name.
564
+ # @param database_name [String] Cosmos DB database name.
565
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
566
+ # will be added to the HTTP request.
567
+ #
568
+ # @return [Concurrent::Promise] promise which provides async access to http
569
+ # response.
570
+ #
571
+ def migrate_sql_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:nil)
572
+ # Send request
573
+ promise = begin_migrate_sql_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers)
574
+
575
+ promise = promise.then do |response|
576
+ # Defining deserialization method.
577
+ deserialize_method = lambda do |parsed_response|
578
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
579
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
580
+ end
581
+
582
+ # Waiting for response.
583
+ @client.get_long_running_operation_result(response, deserialize_method)
584
+ end
585
+
586
+ promise
587
+ end
588
+
497
589
  #
498
590
  # Lists the SQL container under an existing Azure Cosmos DB database account.
499
591
  #
@@ -982,6 +1074,102 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
982
1074
  promise
983
1075
  end
984
1076
 
1077
+ #
1078
+ # Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale
1079
+ #
1080
+ # @param resource_group_name [String] The name of the resource group. The name
1081
+ # is case insensitive.
1082
+ # @param account_name [String] Cosmos DB database account name.
1083
+ # @param database_name [String] Cosmos DB database name.
1084
+ # @param container_name [String] Cosmos DB container name.
1085
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1086
+ # will be added to the HTTP request.
1087
+ #
1088
+ # @return [ThroughputSettingsGetResults] operation results.
1089
+ #
1090
+ def migrate_sql_container_to_autoscale(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1091
+ response = migrate_sql_container_to_autoscale_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
1092
+ response.body unless response.nil?
1093
+ end
1094
+
1095
+ #
1096
+ # @param resource_group_name [String] The name of the resource group. The name
1097
+ # is case insensitive.
1098
+ # @param account_name [String] Cosmos DB database account name.
1099
+ # @param database_name [String] Cosmos DB database name.
1100
+ # @param container_name [String] Cosmos DB container name.
1101
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1102
+ # will be added to the HTTP request.
1103
+ #
1104
+ # @return [Concurrent::Promise] promise which provides async access to http
1105
+ # response.
1106
+ #
1107
+ def migrate_sql_container_to_autoscale_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1108
+ # Send request
1109
+ promise = begin_migrate_sql_container_to_autoscale_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers)
1110
+
1111
+ promise = promise.then do |response|
1112
+ # Defining deserialization method.
1113
+ deserialize_method = lambda do |parsed_response|
1114
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1115
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1116
+ end
1117
+
1118
+ # Waiting for response.
1119
+ @client.get_long_running_operation_result(response, deserialize_method)
1120
+ end
1121
+
1122
+ promise
1123
+ end
1124
+
1125
+ #
1126
+ # Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput
1127
+ #
1128
+ # @param resource_group_name [String] The name of the resource group. The name
1129
+ # is case insensitive.
1130
+ # @param account_name [String] Cosmos DB database account name.
1131
+ # @param database_name [String] Cosmos DB database name.
1132
+ # @param container_name [String] Cosmos DB container name.
1133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1134
+ # will be added to the HTTP request.
1135
+ #
1136
+ # @return [ThroughputSettingsGetResults] operation results.
1137
+ #
1138
+ def migrate_sql_container_to_manual_throughput(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1139
+ response = migrate_sql_container_to_manual_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
1140
+ response.body unless response.nil?
1141
+ end
1142
+
1143
+ #
1144
+ # @param resource_group_name [String] The name of the resource group. The name
1145
+ # is case insensitive.
1146
+ # @param account_name [String] Cosmos DB database account name.
1147
+ # @param database_name [String] Cosmos DB database name.
1148
+ # @param container_name [String] Cosmos DB container name.
1149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1150
+ # will be added to the HTTP request.
1151
+ #
1152
+ # @return [Concurrent::Promise] promise which provides async access to http
1153
+ # response.
1154
+ #
1155
+ def migrate_sql_container_to_manual_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1156
+ # Send request
1157
+ promise = begin_migrate_sql_container_to_manual_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers)
1158
+
1159
+ promise = promise.then do |response|
1160
+ # Defining deserialization method.
1161
+ deserialize_method = lambda do |parsed_response|
1162
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1163
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1164
+ end
1165
+
1166
+ # Waiting for response.
1167
+ @client.get_long_running_operation_result(response, deserialize_method)
1168
+ end
1169
+
1170
+ promise
1171
+ end
1172
+
985
1173
  #
986
1174
  # Lists the SQL storedProcedure under an existing Azure Cosmos DB database
987
1175
  # account.
@@ -2345,63 +2533,51 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2345
2533
  end
2346
2534
 
2347
2535
  #
2348
- # Create or update an Azure Cosmos DB SQL container
2536
+ # Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale
2349
2537
  #
2350
2538
  # @param resource_group_name [String] The name of the resource group. The name
2351
2539
  # is case insensitive.
2352
2540
  # @param account_name [String] Cosmos DB database account name.
2353
2541
  # @param database_name [String] Cosmos DB database name.
2354
- # @param container_name [String] Cosmos DB container name.
2355
- # @param create_update_sql_container_parameters
2356
- # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2357
- # current SQL container.
2358
2542
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
2359
2543
  # will be added to the HTTP request.
2360
2544
  #
2361
- # @return [SqlContainerGetResults] operation results.
2545
+ # @return [ThroughputSettingsGetResults] operation results.
2362
2546
  #
2363
- def begin_create_update_sql_container(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2364
- response = begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:custom_headers).value!
2547
+ def begin_migrate_sql_database_to_autoscale(resource_group_name, account_name, database_name, custom_headers:nil)
2548
+ response = begin_migrate_sql_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
2365
2549
  response.body unless response.nil?
2366
2550
  end
2367
2551
 
2368
2552
  #
2369
- # Create or update an Azure Cosmos DB SQL container
2553
+ # Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale
2370
2554
  #
2371
2555
  # @param resource_group_name [String] The name of the resource group. The name
2372
2556
  # is case insensitive.
2373
2557
  # @param account_name [String] Cosmos DB database account name.
2374
2558
  # @param database_name [String] Cosmos DB database name.
2375
- # @param container_name [String] Cosmos DB container name.
2376
- # @param create_update_sql_container_parameters
2377
- # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2378
- # current SQL container.
2379
2559
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
2380
2560
  # will be added to the HTTP request.
2381
2561
  #
2382
2562
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2383
2563
  #
2384
- def begin_create_update_sql_container_with_http_info(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2385
- begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:custom_headers).value!
2564
+ def begin_migrate_sql_database_to_autoscale_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
2565
+ begin_migrate_sql_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
2386
2566
  end
2387
2567
 
2388
2568
  #
2389
- # Create or update an Azure Cosmos DB SQL container
2569
+ # Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale
2390
2570
  #
2391
2571
  # @param resource_group_name [String] The name of the resource group. The name
2392
2572
  # is case insensitive.
2393
2573
  # @param account_name [String] Cosmos DB database account name.
2394
2574
  # @param database_name [String] Cosmos DB database name.
2395
- # @param container_name [String] Cosmos DB container name.
2396
- # @param create_update_sql_container_parameters
2397
- # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2398
- # current SQL container.
2399
2575
  # @param [Hash{String => String}] A hash of custom headers that will be added
2400
2576
  # to the HTTP request.
2401
2577
  #
2402
2578
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2403
2579
  #
2404
- def begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2580
+ def begin_migrate_sql_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:nil)
2405
2581
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2406
2582
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
2407
2583
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
@@ -2413,10 +2589,8 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2413
2589
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2414
2590
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
2415
2591
  fail ArgumentError, 'database_name is nil' if database_name.nil?
2416
- fail ArgumentError, 'container_name is nil' if container_name.nil?
2417
2592
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2418
2593
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
2419
- fail ArgumentError, 'create_update_sql_container_parameters is nil' if create_update_sql_container_parameters.nil?
2420
2594
 
2421
2595
 
2422
2596
  request_headers = {}
@@ -2425,25 +2599,18 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2425
2599
  # Set Headers
2426
2600
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2427
2601
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2428
-
2429
- # Serialize Request
2430
- request_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::SqlContainerCreateUpdateParameters.mapper()
2431
- request_content = @client.serialize(request_mapper, create_update_sql_container_parameters)
2432
- request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2433
-
2434
- path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'
2602
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale'
2435
2603
 
2436
2604
  request_url = @base_url || @client.base_url
2437
2605
 
2438
2606
  options = {
2439
2607
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2440
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
2608
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
2441
2609
  query_params: {'api-version' => @client.api_version},
2442
- body: request_content,
2443
2610
  headers: request_headers.merge(custom_headers || {}),
2444
2611
  base_url: request_url
2445
2612
  }
2446
- promise = @client.make_request_async(:put, path_template, options)
2613
+ promise = @client.make_request_async(:post, path_template, options)
2447
2614
 
2448
2615
  promise = promise.then do |result|
2449
2616
  http_response = result.response
@@ -2461,7 +2628,7 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2461
2628
  if status_code == 200
2462
2629
  begin
2463
2630
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2464
- result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::SqlContainerGetResults.mapper()
2631
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
2465
2632
  result.body = @client.deserialize(result_mapper, parsed_response)
2466
2633
  rescue Exception => e
2467
2634
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -2475,53 +2642,51 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2475
2642
  end
2476
2643
 
2477
2644
  #
2478
- # Deletes an existing Azure Cosmos DB SQL container.
2645
+ # Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput
2479
2646
  #
2480
2647
  # @param resource_group_name [String] The name of the resource group. The name
2481
2648
  # is case insensitive.
2482
2649
  # @param account_name [String] Cosmos DB database account name.
2483
2650
  # @param database_name [String] Cosmos DB database name.
2484
- # @param container_name [String] Cosmos DB container name.
2485
2651
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
2486
2652
  # will be added to the HTTP request.
2487
2653
  #
2654
+ # @return [ThroughputSettingsGetResults] operation results.
2488
2655
  #
2489
- def begin_delete_sql_container(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2490
- response = begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
2491
- nil
2656
+ def begin_migrate_sql_database_to_manual_throughput(resource_group_name, account_name, database_name, custom_headers:nil)
2657
+ response = begin_migrate_sql_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
2658
+ response.body unless response.nil?
2492
2659
  end
2493
2660
 
2494
2661
  #
2495
- # Deletes an existing Azure Cosmos DB SQL container.
2662
+ # Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput
2496
2663
  #
2497
2664
  # @param resource_group_name [String] The name of the resource group. The name
2498
2665
  # is case insensitive.
2499
2666
  # @param account_name [String] Cosmos DB database account name.
2500
2667
  # @param database_name [String] Cosmos DB database name.
2501
- # @param container_name [String] Cosmos DB container name.
2502
2668
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
2503
2669
  # will be added to the HTTP request.
2504
2670
  #
2505
2671
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2506
2672
  #
2507
- def begin_delete_sql_container_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2508
- begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
2673
+ def begin_migrate_sql_database_to_manual_throughput_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
2674
+ begin_migrate_sql_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
2509
2675
  end
2510
2676
 
2511
2677
  #
2512
- # Deletes an existing Azure Cosmos DB SQL container.
2678
+ # Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput
2513
2679
  #
2514
2680
  # @param resource_group_name [String] The name of the resource group. The name
2515
2681
  # is case insensitive.
2516
2682
  # @param account_name [String] Cosmos DB database account name.
2517
2683
  # @param database_name [String] Cosmos DB database name.
2518
- # @param container_name [String] Cosmos DB container name.
2519
2684
  # @param [Hash{String => String}] A hash of custom headers that will be added
2520
2685
  # to the HTTP request.
2521
2686
  #
2522
2687
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2523
2688
  #
2524
- def begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2689
+ def begin_migrate_sql_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:nil)
2525
2690
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2526
2691
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
2527
2692
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
@@ -2533,7 +2698,6 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2533
2698
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2534
2699
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
2535
2700
  fail ArgumentError, 'database_name is nil' if database_name.nil?
2536
- fail ArgumentError, 'container_name is nil' if container_name.nil?
2537
2701
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2538
2702
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
2539
2703
 
@@ -2544,24 +2708,24 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2544
2708
  # Set Headers
2545
2709
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2546
2710
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2547
- path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'
2711
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput'
2548
2712
 
2549
2713
  request_url = @base_url || @client.base_url
2550
2714
 
2551
2715
  options = {
2552
2716
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2553
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
2717
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
2554
2718
  query_params: {'api-version' => @client.api_version},
2555
2719
  headers: request_headers.merge(custom_headers || {}),
2556
2720
  base_url: request_url
2557
2721
  }
2558
- promise = @client.make_request_async(:delete, path_template, options)
2722
+ promise = @client.make_request_async(:post, path_template, options)
2559
2723
 
2560
2724
  promise = promise.then do |result|
2561
2725
  http_response = result.response
2562
2726
  status_code = http_response.status
2563
2727
  response_content = http_response.body
2564
- unless status_code == 202 || status_code == 204
2728
+ unless status_code == 202 || status_code == 200
2565
2729
  error_model = JSON.load(response_content)
2566
2730
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2567
2731
  end
@@ -2569,6 +2733,16 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2569
2733
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2570
2734
  result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2571
2735
  result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2736
+ # Deserialize Response
2737
+ if status_code == 200
2738
+ begin
2739
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2740
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
2741
+ result.body = @client.deserialize(result_mapper, parsed_response)
2742
+ rescue Exception => e
2743
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2744
+ end
2745
+ end
2572
2746
 
2573
2747
  result
2574
2748
  end
@@ -2577,35 +2751,267 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2577
2751
  end
2578
2752
 
2579
2753
  #
2580
- # Update RUs per second of an Azure Cosmos DB SQL container
2754
+ # Create or update an Azure Cosmos DB SQL container
2581
2755
  #
2582
2756
  # @param resource_group_name [String] The name of the resource group. The name
2583
2757
  # is case insensitive.
2584
2758
  # @param account_name [String] Cosmos DB database account name.
2585
2759
  # @param database_name [String] Cosmos DB database name.
2586
2760
  # @param container_name [String] Cosmos DB container name.
2587
- # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2588
- # parameters to provide for the RUs per second of the current SQL container.
2761
+ # @param create_update_sql_container_parameters
2762
+ # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2763
+ # current SQL container.
2589
2764
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
2590
2765
  # will be added to the HTTP request.
2591
2766
  #
2592
- # @return [ThroughputSettingsGetResults] operation results.
2767
+ # @return [SqlContainerGetResults] operation results.
2593
2768
  #
2594
- def begin_update_sql_container_throughput(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:nil)
2595
- response = begin_update_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:custom_headers).value!
2769
+ def begin_create_update_sql_container(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2770
+ response = begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:custom_headers).value!
2596
2771
  response.body unless response.nil?
2597
2772
  end
2598
2773
 
2599
2774
  #
2600
- # Update RUs per second of an Azure Cosmos DB SQL container
2775
+ # Create or update an Azure Cosmos DB SQL container
2601
2776
  #
2602
2777
  # @param resource_group_name [String] The name of the resource group. The name
2603
2778
  # is case insensitive.
2604
2779
  # @param account_name [String] Cosmos DB database account name.
2605
2780
  # @param database_name [String] Cosmos DB database name.
2606
2781
  # @param container_name [String] Cosmos DB container name.
2607
- # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2608
- # parameters to provide for the RUs per second of the current SQL container.
2782
+ # @param create_update_sql_container_parameters
2783
+ # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2784
+ # current SQL container.
2785
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2786
+ # will be added to the HTTP request.
2787
+ #
2788
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2789
+ #
2790
+ def begin_create_update_sql_container_with_http_info(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2791
+ begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:custom_headers).value!
2792
+ end
2793
+
2794
+ #
2795
+ # Create or update an Azure Cosmos DB SQL container
2796
+ #
2797
+ # @param resource_group_name [String] The name of the resource group. The name
2798
+ # is case insensitive.
2799
+ # @param account_name [String] Cosmos DB database account name.
2800
+ # @param database_name [String] Cosmos DB database name.
2801
+ # @param container_name [String] Cosmos DB container name.
2802
+ # @param create_update_sql_container_parameters
2803
+ # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2804
+ # current SQL container.
2805
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2806
+ # to the HTTP request.
2807
+ #
2808
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2809
+ #
2810
+ def begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2811
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2812
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
2813
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2814
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2815
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2816
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2817
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2818
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2819
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2820
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
2821
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2822
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
2823
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2824
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
2825
+ fail ArgumentError, 'create_update_sql_container_parameters is nil' if create_update_sql_container_parameters.nil?
2826
+
2827
+
2828
+ request_headers = {}
2829
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2830
+
2831
+ # Set Headers
2832
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2833
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2834
+
2835
+ # Serialize Request
2836
+ request_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::SqlContainerCreateUpdateParameters.mapper()
2837
+ request_content = @client.serialize(request_mapper, create_update_sql_container_parameters)
2838
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2839
+
2840
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'
2841
+
2842
+ request_url = @base_url || @client.base_url
2843
+
2844
+ options = {
2845
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2846
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
2847
+ query_params: {'api-version' => @client.api_version},
2848
+ body: request_content,
2849
+ headers: request_headers.merge(custom_headers || {}),
2850
+ base_url: request_url
2851
+ }
2852
+ promise = @client.make_request_async(:put, path_template, options)
2853
+
2854
+ promise = promise.then do |result|
2855
+ http_response = result.response
2856
+ status_code = http_response.status
2857
+ response_content = http_response.body
2858
+ unless status_code == 202 || status_code == 200
2859
+ error_model = JSON.load(response_content)
2860
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2861
+ end
2862
+
2863
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2864
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2865
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2866
+ # Deserialize Response
2867
+ if status_code == 200
2868
+ begin
2869
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2870
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::SqlContainerGetResults.mapper()
2871
+ result.body = @client.deserialize(result_mapper, parsed_response)
2872
+ rescue Exception => e
2873
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2874
+ end
2875
+ end
2876
+
2877
+ result
2878
+ end
2879
+
2880
+ promise.execute
2881
+ end
2882
+
2883
+ #
2884
+ # Deletes an existing Azure Cosmos DB SQL container.
2885
+ #
2886
+ # @param resource_group_name [String] The name of the resource group. The name
2887
+ # is case insensitive.
2888
+ # @param account_name [String] Cosmos DB database account name.
2889
+ # @param database_name [String] Cosmos DB database name.
2890
+ # @param container_name [String] Cosmos DB container name.
2891
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2892
+ # will be added to the HTTP request.
2893
+ #
2894
+ #
2895
+ def begin_delete_sql_container(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2896
+ response = begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
2897
+ nil
2898
+ end
2899
+
2900
+ #
2901
+ # Deletes an existing Azure Cosmos DB SQL container.
2902
+ #
2903
+ # @param resource_group_name [String] The name of the resource group. The name
2904
+ # is case insensitive.
2905
+ # @param account_name [String] Cosmos DB database account name.
2906
+ # @param database_name [String] Cosmos DB database name.
2907
+ # @param container_name [String] Cosmos DB container name.
2908
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2909
+ # will be added to the HTTP request.
2910
+ #
2911
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2912
+ #
2913
+ def begin_delete_sql_container_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2914
+ begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
2915
+ end
2916
+
2917
+ #
2918
+ # Deletes an existing Azure Cosmos DB SQL container.
2919
+ #
2920
+ # @param resource_group_name [String] The name of the resource group. The name
2921
+ # is case insensitive.
2922
+ # @param account_name [String] Cosmos DB database account name.
2923
+ # @param database_name [String] Cosmos DB database name.
2924
+ # @param container_name [String] Cosmos DB container name.
2925
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2926
+ # to the HTTP request.
2927
+ #
2928
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2929
+ #
2930
+ def begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2931
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2932
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
2933
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2934
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2935
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2936
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2937
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2938
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2939
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2940
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
2941
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2942
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
2943
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2944
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
2945
+
2946
+
2947
+ request_headers = {}
2948
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2949
+
2950
+ # Set Headers
2951
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2952
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2953
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'
2954
+
2955
+ request_url = @base_url || @client.base_url
2956
+
2957
+ options = {
2958
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2959
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
2960
+ query_params: {'api-version' => @client.api_version},
2961
+ headers: request_headers.merge(custom_headers || {}),
2962
+ base_url: request_url
2963
+ }
2964
+ promise = @client.make_request_async(:delete, path_template, options)
2965
+
2966
+ promise = promise.then do |result|
2967
+ http_response = result.response
2968
+ status_code = http_response.status
2969
+ response_content = http_response.body
2970
+ unless status_code == 202 || status_code == 204
2971
+ error_model = JSON.load(response_content)
2972
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2973
+ end
2974
+
2975
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2976
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2977
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2978
+
2979
+ result
2980
+ end
2981
+
2982
+ promise.execute
2983
+ end
2984
+
2985
+ #
2986
+ # Update RUs per second of an Azure Cosmos DB SQL container
2987
+ #
2988
+ # @param resource_group_name [String] The name of the resource group. The name
2989
+ # is case insensitive.
2990
+ # @param account_name [String] Cosmos DB database account name.
2991
+ # @param database_name [String] Cosmos DB database name.
2992
+ # @param container_name [String] Cosmos DB container name.
2993
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2994
+ # parameters to provide for the RUs per second of the current SQL container.
2995
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2996
+ # will be added to the HTTP request.
2997
+ #
2998
+ # @return [ThroughputSettingsGetResults] operation results.
2999
+ #
3000
+ def begin_update_sql_container_throughput(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:nil)
3001
+ response = begin_update_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:custom_headers).value!
3002
+ response.body unless response.nil?
3003
+ end
3004
+
3005
+ #
3006
+ # Update RUs per second of an Azure Cosmos DB SQL container
3007
+ #
3008
+ # @param resource_group_name [String] The name of the resource group. The name
3009
+ # is case insensitive.
3010
+ # @param account_name [String] Cosmos DB database account name.
3011
+ # @param database_name [String] Cosmos DB database name.
3012
+ # @param container_name [String] Cosmos DB container name.
3013
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
3014
+ # parameters to provide for the RUs per second of the current SQL container.
2609
3015
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
2610
3016
  # will be added to the HTTP request.
2611
3017
  #
@@ -2703,6 +3109,232 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
2703
3109
  promise.execute
2704
3110
  end
2705
3111
 
3112
+ #
3113
+ # Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale
3114
+ #
3115
+ # @param resource_group_name [String] The name of the resource group. The name
3116
+ # is case insensitive.
3117
+ # @param account_name [String] Cosmos DB database account name.
3118
+ # @param database_name [String] Cosmos DB database name.
3119
+ # @param container_name [String] Cosmos DB container name.
3120
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3121
+ # will be added to the HTTP request.
3122
+ #
3123
+ # @return [ThroughputSettingsGetResults] operation results.
3124
+ #
3125
+ def begin_migrate_sql_container_to_autoscale(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
3126
+ response = begin_migrate_sql_container_to_autoscale_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
3127
+ response.body unless response.nil?
3128
+ end
3129
+
3130
+ #
3131
+ # Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale
3132
+ #
3133
+ # @param resource_group_name [String] The name of the resource group. The name
3134
+ # is case insensitive.
3135
+ # @param account_name [String] Cosmos DB database account name.
3136
+ # @param database_name [String] Cosmos DB database name.
3137
+ # @param container_name [String] Cosmos DB container name.
3138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3139
+ # will be added to the HTTP request.
3140
+ #
3141
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3142
+ #
3143
+ def begin_migrate_sql_container_to_autoscale_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
3144
+ begin_migrate_sql_container_to_autoscale_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
3145
+ end
3146
+
3147
+ #
3148
+ # Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale
3149
+ #
3150
+ # @param resource_group_name [String] The name of the resource group. The name
3151
+ # is case insensitive.
3152
+ # @param account_name [String] Cosmos DB database account name.
3153
+ # @param database_name [String] Cosmos DB database name.
3154
+ # @param container_name [String] Cosmos DB container name.
3155
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3156
+ # to the HTTP request.
3157
+ #
3158
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3159
+ #
3160
+ def begin_migrate_sql_container_to_autoscale_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
3161
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
3162
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
3163
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
3164
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
3165
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
3166
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
3167
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
3168
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
3169
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
3170
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
3171
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
3172
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
3173
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
3174
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
3175
+
3176
+
3177
+ request_headers = {}
3178
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3179
+
3180
+ # Set Headers
3181
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3182
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3183
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale'
3184
+
3185
+ request_url = @base_url || @client.base_url
3186
+
3187
+ options = {
3188
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3189
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
3190
+ query_params: {'api-version' => @client.api_version},
3191
+ headers: request_headers.merge(custom_headers || {}),
3192
+ base_url: request_url
3193
+ }
3194
+ promise = @client.make_request_async(:post, path_template, options)
3195
+
3196
+ promise = promise.then do |result|
3197
+ http_response = result.response
3198
+ status_code = http_response.status
3199
+ response_content = http_response.body
3200
+ unless status_code == 202 || status_code == 200
3201
+ error_model = JSON.load(response_content)
3202
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3203
+ end
3204
+
3205
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3206
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3207
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3208
+ # Deserialize Response
3209
+ if status_code == 200
3210
+ begin
3211
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3212
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
3213
+ result.body = @client.deserialize(result_mapper, parsed_response)
3214
+ rescue Exception => e
3215
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3216
+ end
3217
+ end
3218
+
3219
+ result
3220
+ end
3221
+
3222
+ promise.execute
3223
+ end
3224
+
3225
+ #
3226
+ # Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput
3227
+ #
3228
+ # @param resource_group_name [String] The name of the resource group. The name
3229
+ # is case insensitive.
3230
+ # @param account_name [String] Cosmos DB database account name.
3231
+ # @param database_name [String] Cosmos DB database name.
3232
+ # @param container_name [String] Cosmos DB container name.
3233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3234
+ # will be added to the HTTP request.
3235
+ #
3236
+ # @return [ThroughputSettingsGetResults] operation results.
3237
+ #
3238
+ def begin_migrate_sql_container_to_manual_throughput(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
3239
+ response = begin_migrate_sql_container_to_manual_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
3240
+ response.body unless response.nil?
3241
+ end
3242
+
3243
+ #
3244
+ # Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput
3245
+ #
3246
+ # @param resource_group_name [String] The name of the resource group. The name
3247
+ # is case insensitive.
3248
+ # @param account_name [String] Cosmos DB database account name.
3249
+ # @param database_name [String] Cosmos DB database name.
3250
+ # @param container_name [String] Cosmos DB container name.
3251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3252
+ # will be added to the HTTP request.
3253
+ #
3254
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3255
+ #
3256
+ def begin_migrate_sql_container_to_manual_throughput_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
3257
+ begin_migrate_sql_container_to_manual_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
3258
+ end
3259
+
3260
+ #
3261
+ # Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput
3262
+ #
3263
+ # @param resource_group_name [String] The name of the resource group. The name
3264
+ # is case insensitive.
3265
+ # @param account_name [String] Cosmos DB database account name.
3266
+ # @param database_name [String] Cosmos DB database name.
3267
+ # @param container_name [String] Cosmos DB container name.
3268
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3269
+ # to the HTTP request.
3270
+ #
3271
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3272
+ #
3273
+ def begin_migrate_sql_container_to_manual_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
3274
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
3275
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
3276
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
3277
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
3278
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
3279
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
3280
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
3281
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
3282
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
3283
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
3284
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
3285
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
3286
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
3287
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
3288
+
3289
+
3290
+ request_headers = {}
3291
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3292
+
3293
+ # Set Headers
3294
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3295
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3296
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput'
3297
+
3298
+ request_url = @base_url || @client.base_url
3299
+
3300
+ options = {
3301
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3302
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
3303
+ query_params: {'api-version' => @client.api_version},
3304
+ headers: request_headers.merge(custom_headers || {}),
3305
+ base_url: request_url
3306
+ }
3307
+ promise = @client.make_request_async(:post, path_template, options)
3308
+
3309
+ promise = promise.then do |result|
3310
+ http_response = result.response
3311
+ status_code = http_response.status
3312
+ response_content = http_response.body
3313
+ unless status_code == 202 || status_code == 200
3314
+ error_model = JSON.load(response_content)
3315
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3316
+ end
3317
+
3318
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3319
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3320
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3321
+ # Deserialize Response
3322
+ if status_code == 200
3323
+ begin
3324
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3325
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
3326
+ result.body = @client.deserialize(result_mapper, parsed_response)
3327
+ rescue Exception => e
3328
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3329
+ end
3330
+ end
3331
+
3332
+ result
3333
+ end
3334
+
3335
+ promise.execute
3336
+ end
3337
+
2706
3338
  #
2707
3339
  # Create or update an Azure Cosmos DB SQL storedProcedure
2708
3340
  #