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
@@ -196,7 +196,7 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
196
196
  #
197
197
  def add_telemetry
198
198
  sdk_information = 'azure_mgmt_cosmosdb'
199
- sdk_information = "#{sdk_information}/0.21.2"
199
+ sdk_information = "#{sdk_information}/0.22.0"
200
200
  add_user_agent_information(sdk_information)
201
201
  end
202
202
  end
@@ -497,6 +497,100 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
497
497
  promise
498
498
  end
499
499
 
500
+ #
501
+ # Migrate an Azure Cosmos DB Gremlin database from manual throughput to
502
+ # autoscale
503
+ #
504
+ # @param resource_group_name [String] The name of the resource group. The name
505
+ # is case insensitive.
506
+ # @param account_name [String] Cosmos DB database account name.
507
+ # @param database_name [String] Cosmos DB database name.
508
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
509
+ # will be added to the HTTP request.
510
+ #
511
+ # @return [ThroughputSettingsGetResults] operation results.
512
+ #
513
+ def migrate_gremlin_database_to_autoscale(resource_group_name, account_name, database_name, custom_headers:nil)
514
+ response = migrate_gremlin_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
515
+ response.body unless response.nil?
516
+ end
517
+
518
+ #
519
+ # @param resource_group_name [String] The name of the resource group. The name
520
+ # is case insensitive.
521
+ # @param account_name [String] Cosmos DB database account name.
522
+ # @param database_name [String] Cosmos DB database name.
523
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
524
+ # will be added to the HTTP request.
525
+ #
526
+ # @return [Concurrent::Promise] promise which provides async access to http
527
+ # response.
528
+ #
529
+ def migrate_gremlin_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:nil)
530
+ # Send request
531
+ promise = begin_migrate_gremlin_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers)
532
+
533
+ promise = promise.then do |response|
534
+ # Defining deserialization method.
535
+ deserialize_method = lambda do |parsed_response|
536
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
537
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
538
+ end
539
+
540
+ # Waiting for response.
541
+ @client.get_long_running_operation_result(response, deserialize_method)
542
+ end
543
+
544
+ promise
545
+ end
546
+
547
+ #
548
+ # Migrate an Azure Cosmos DB Gremlin database from autoscale to manual
549
+ # throughput
550
+ #
551
+ # @param resource_group_name [String] The name of the resource group. The name
552
+ # is case insensitive.
553
+ # @param account_name [String] Cosmos DB database account name.
554
+ # @param database_name [String] Cosmos DB database name.
555
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
556
+ # will be added to the HTTP request.
557
+ #
558
+ # @return [ThroughputSettingsGetResults] operation results.
559
+ #
560
+ def migrate_gremlin_database_to_manual_throughput(resource_group_name, account_name, database_name, custom_headers:nil)
561
+ response = migrate_gremlin_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
562
+ response.body unless response.nil?
563
+ end
564
+
565
+ #
566
+ # @param resource_group_name [String] The name of the resource group. The name
567
+ # is case insensitive.
568
+ # @param account_name [String] Cosmos DB database account name.
569
+ # @param database_name [String] Cosmos DB database name.
570
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
571
+ # will be added to the HTTP request.
572
+ #
573
+ # @return [Concurrent::Promise] promise which provides async access to http
574
+ # response.
575
+ #
576
+ def migrate_gremlin_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:nil)
577
+ # Send request
578
+ promise = begin_migrate_gremlin_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers)
579
+
580
+ promise = promise.then do |response|
581
+ # Defining deserialization method.
582
+ deserialize_method = lambda do |parsed_response|
583
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
584
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
585
+ end
586
+
587
+ # Waiting for response.
588
+ @client.get_long_running_operation_result(response, deserialize_method)
589
+ end
590
+
591
+ promise
592
+ end
593
+
500
594
  #
501
595
  # Lists the Gremlin graph under an existing Azure Cosmos DB database account.
502
596
  #
@@ -985,6 +1079,102 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
985
1079
  promise
986
1080
  end
987
1081
 
1082
+ #
1083
+ # Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale
1084
+ #
1085
+ # @param resource_group_name [String] The name of the resource group. The name
1086
+ # is case insensitive.
1087
+ # @param account_name [String] Cosmos DB database account name.
1088
+ # @param database_name [String] Cosmos DB database name.
1089
+ # @param graph_name [String] Cosmos DB graph name.
1090
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1091
+ # will be added to the HTTP request.
1092
+ #
1093
+ # @return [ThroughputSettingsGetResults] operation results.
1094
+ #
1095
+ def migrate_gremlin_graph_to_autoscale(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1096
+ response = migrate_gremlin_graph_to_autoscale_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
1097
+ response.body unless response.nil?
1098
+ end
1099
+
1100
+ #
1101
+ # @param resource_group_name [String] The name of the resource group. The name
1102
+ # is case insensitive.
1103
+ # @param account_name [String] Cosmos DB database account name.
1104
+ # @param database_name [String] Cosmos DB database name.
1105
+ # @param graph_name [String] Cosmos DB graph name.
1106
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1107
+ # will be added to the HTTP request.
1108
+ #
1109
+ # @return [Concurrent::Promise] promise which provides async access to http
1110
+ # response.
1111
+ #
1112
+ def migrate_gremlin_graph_to_autoscale_async(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1113
+ # Send request
1114
+ promise = begin_migrate_gremlin_graph_to_autoscale_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers)
1115
+
1116
+ promise = promise.then do |response|
1117
+ # Defining deserialization method.
1118
+ deserialize_method = lambda do |parsed_response|
1119
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1120
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1121
+ end
1122
+
1123
+ # Waiting for response.
1124
+ @client.get_long_running_operation_result(response, deserialize_method)
1125
+ end
1126
+
1127
+ promise
1128
+ end
1129
+
1130
+ #
1131
+ # Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput
1132
+ #
1133
+ # @param resource_group_name [String] The name of the resource group. The name
1134
+ # is case insensitive.
1135
+ # @param account_name [String] Cosmos DB database account name.
1136
+ # @param database_name [String] Cosmos DB database name.
1137
+ # @param graph_name [String] Cosmos DB graph name.
1138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1139
+ # will be added to the HTTP request.
1140
+ #
1141
+ # @return [ThroughputSettingsGetResults] operation results.
1142
+ #
1143
+ def migrate_gremlin_graph_to_manual_throughput(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1144
+ response = migrate_gremlin_graph_to_manual_throughput_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
1145
+ response.body unless response.nil?
1146
+ end
1147
+
1148
+ #
1149
+ # @param resource_group_name [String] The name of the resource group. The name
1150
+ # is case insensitive.
1151
+ # @param account_name [String] Cosmos DB database account name.
1152
+ # @param database_name [String] Cosmos DB database name.
1153
+ # @param graph_name [String] Cosmos DB graph name.
1154
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1155
+ # will be added to the HTTP request.
1156
+ #
1157
+ # @return [Concurrent::Promise] promise which provides async access to http
1158
+ # response.
1159
+ #
1160
+ def migrate_gremlin_graph_to_manual_throughput_async(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1161
+ # Send request
1162
+ promise = begin_migrate_gremlin_graph_to_manual_throughput_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers)
1163
+
1164
+ promise = promise.then do |response|
1165
+ # Defining deserialization method.
1166
+ deserialize_method = lambda do |parsed_response|
1167
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1168
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1169
+ end
1170
+
1171
+ # Waiting for response.
1172
+ @client.get_long_running_operation_result(response, deserialize_method)
1173
+ end
1174
+
1175
+ promise
1176
+ end
1177
+
988
1178
  #
989
1179
  # Create or update an Azure Cosmos DB Gremlin database
990
1180
  #
@@ -1333,63 +1523,54 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1333
1523
  end
1334
1524
 
1335
1525
  #
1336
- # Create or update an Azure Cosmos DB Gremlin graph
1526
+ # Migrate an Azure Cosmos DB Gremlin database from manual throughput to
1527
+ # autoscale
1337
1528
  #
1338
1529
  # @param resource_group_name [String] The name of the resource group. The name
1339
1530
  # is case insensitive.
1340
1531
  # @param account_name [String] Cosmos DB database account name.
1341
1532
  # @param database_name [String] Cosmos DB database name.
1342
- # @param graph_name [String] Cosmos DB graph name.
1343
- # @param create_update_gremlin_graph_parameters
1344
- # [GremlinGraphCreateUpdateParameters] The parameters to provide for the
1345
- # current Gremlin graph.
1346
1533
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1347
1534
  # will be added to the HTTP request.
1348
1535
  #
1349
- # @return [GremlinGraphGetResults] operation results.
1536
+ # @return [ThroughputSettingsGetResults] operation results.
1350
1537
  #
1351
- def begin_create_update_gremlin_graph(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:nil)
1352
- response = begin_create_update_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:custom_headers).value!
1538
+ def begin_migrate_gremlin_database_to_autoscale(resource_group_name, account_name, database_name, custom_headers:nil)
1539
+ response = begin_migrate_gremlin_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1353
1540
  response.body unless response.nil?
1354
1541
  end
1355
1542
 
1356
1543
  #
1357
- # Create or update an Azure Cosmos DB Gremlin graph
1544
+ # Migrate an Azure Cosmos DB Gremlin database from manual throughput to
1545
+ # autoscale
1358
1546
  #
1359
1547
  # @param resource_group_name [String] The name of the resource group. The name
1360
1548
  # is case insensitive.
1361
1549
  # @param account_name [String] Cosmos DB database account name.
1362
1550
  # @param database_name [String] Cosmos DB database name.
1363
- # @param graph_name [String] Cosmos DB graph name.
1364
- # @param create_update_gremlin_graph_parameters
1365
- # [GremlinGraphCreateUpdateParameters] The parameters to provide for the
1366
- # current Gremlin graph.
1367
1551
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1368
1552
  # will be added to the HTTP request.
1369
1553
  #
1370
1554
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1371
1555
  #
1372
- def begin_create_update_gremlin_graph_with_http_info(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:nil)
1373
- begin_create_update_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:custom_headers).value!
1556
+ def begin_migrate_gremlin_database_to_autoscale_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
1557
+ begin_migrate_gremlin_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1374
1558
  end
1375
1559
 
1376
1560
  #
1377
- # Create or update an Azure Cosmos DB Gremlin graph
1561
+ # Migrate an Azure Cosmos DB Gremlin database from manual throughput to
1562
+ # autoscale
1378
1563
  #
1379
1564
  # @param resource_group_name [String] The name of the resource group. The name
1380
1565
  # is case insensitive.
1381
1566
  # @param account_name [String] Cosmos DB database account name.
1382
1567
  # @param database_name [String] Cosmos DB database name.
1383
- # @param graph_name [String] Cosmos DB graph name.
1384
- # @param create_update_gremlin_graph_parameters
1385
- # [GremlinGraphCreateUpdateParameters] The parameters to provide for the
1386
- # current Gremlin graph.
1387
1568
  # @param [Hash{String => String}] A hash of custom headers that will be added
1388
1569
  # to the HTTP request.
1389
1570
  #
1390
1571
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1391
1572
  #
1392
- def begin_create_update_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:nil)
1573
+ def begin_migrate_gremlin_database_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:nil)
1393
1574
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1394
1575
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1395
1576
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
@@ -1401,10 +1582,8 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1401
1582
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1402
1583
  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?
1403
1584
  fail ArgumentError, 'database_name is nil' if database_name.nil?
1404
- fail ArgumentError, 'graph_name is nil' if graph_name.nil?
1405
1585
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1406
1586
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1407
- fail ArgumentError, 'create_update_gremlin_graph_parameters is nil' if create_update_gremlin_graph_parameters.nil?
1408
1587
 
1409
1588
 
1410
1589
  request_headers = {}
@@ -1413,25 +1592,18 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1413
1592
  # Set Headers
1414
1593
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1415
1594
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1416
-
1417
- # Serialize Request
1418
- request_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::GremlinGraphCreateUpdateParameters.mapper()
1419
- request_content = @client.serialize(request_mapper, create_update_gremlin_graph_parameters)
1420
- request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1421
-
1422
- path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'
1595
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale'
1423
1596
 
1424
1597
  request_url = @base_url || @client.base_url
1425
1598
 
1426
1599
  options = {
1427
1600
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1428
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'graphName' => graph_name},
1601
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
1429
1602
  query_params: {'api-version' => @client.api_version},
1430
- body: request_content,
1431
1603
  headers: request_headers.merge(custom_headers || {}),
1432
1604
  base_url: request_url
1433
1605
  }
1434
- promise = @client.make_request_async(:put, path_template, options)
1606
+ promise = @client.make_request_async(:post, path_template, options)
1435
1607
 
1436
1608
  promise = promise.then do |result|
1437
1609
  http_response = result.response
@@ -1449,7 +1621,7 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1449
1621
  if status_code == 200
1450
1622
  begin
1451
1623
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1452
- result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::GremlinGraphGetResults.mapper()
1624
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1453
1625
  result.body = @client.deserialize(result_mapper, parsed_response)
1454
1626
  rescue Exception => e
1455
1627
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -1463,53 +1635,54 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1463
1635
  end
1464
1636
 
1465
1637
  #
1466
- # Deletes an existing Azure Cosmos DB Gremlin graph.
1638
+ # Migrate an Azure Cosmos DB Gremlin database from autoscale to manual
1639
+ # throughput
1467
1640
  #
1468
1641
  # @param resource_group_name [String] The name of the resource group. The name
1469
1642
  # is case insensitive.
1470
1643
  # @param account_name [String] Cosmos DB database account name.
1471
1644
  # @param database_name [String] Cosmos DB database name.
1472
- # @param graph_name [String] Cosmos DB graph name.
1473
1645
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1474
1646
  # will be added to the HTTP request.
1475
1647
  #
1648
+ # @return [ThroughputSettingsGetResults] operation results.
1476
1649
  #
1477
- def begin_delete_gremlin_graph(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1478
- response = begin_delete_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
1479
- nil
1650
+ def begin_migrate_gremlin_database_to_manual_throughput(resource_group_name, account_name, database_name, custom_headers:nil)
1651
+ response = begin_migrate_gremlin_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1652
+ response.body unless response.nil?
1480
1653
  end
1481
1654
 
1482
1655
  #
1483
- # Deletes an existing Azure Cosmos DB Gremlin graph.
1656
+ # Migrate an Azure Cosmos DB Gremlin database from autoscale to manual
1657
+ # throughput
1484
1658
  #
1485
1659
  # @param resource_group_name [String] The name of the resource group. The name
1486
1660
  # is case insensitive.
1487
1661
  # @param account_name [String] Cosmos DB database account name.
1488
1662
  # @param database_name [String] Cosmos DB database name.
1489
- # @param graph_name [String] Cosmos DB graph name.
1490
1663
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1491
1664
  # will be added to the HTTP request.
1492
1665
  #
1493
1666
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1494
1667
  #
1495
- def begin_delete_gremlin_graph_with_http_info(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1496
- begin_delete_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
1668
+ def begin_migrate_gremlin_database_to_manual_throughput_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
1669
+ begin_migrate_gremlin_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1497
1670
  end
1498
1671
 
1499
1672
  #
1500
- # Deletes an existing Azure Cosmos DB Gremlin graph.
1673
+ # Migrate an Azure Cosmos DB Gremlin database from autoscale to manual
1674
+ # throughput
1501
1675
  #
1502
1676
  # @param resource_group_name [String] The name of the resource group. The name
1503
1677
  # is case insensitive.
1504
1678
  # @param account_name [String] Cosmos DB database account name.
1505
1679
  # @param database_name [String] Cosmos DB database name.
1506
- # @param graph_name [String] Cosmos DB graph name.
1507
1680
  # @param [Hash{String => String}] A hash of custom headers that will be added
1508
1681
  # to the HTTP request.
1509
1682
  #
1510
1683
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1511
1684
  #
1512
- def begin_delete_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1685
+ def begin_migrate_gremlin_database_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:nil)
1513
1686
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1514
1687
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1515
1688
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
@@ -1521,7 +1694,6 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1521
1694
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1522
1695
  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?
1523
1696
  fail ArgumentError, 'database_name is nil' if database_name.nil?
1524
- fail ArgumentError, 'graph_name is nil' if graph_name.nil?
1525
1697
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1526
1698
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1527
1699
 
@@ -1532,24 +1704,24 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1532
1704
  # Set Headers
1533
1705
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1534
1706
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1535
- path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'
1707
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput'
1536
1708
 
1537
1709
  request_url = @base_url || @client.base_url
1538
1710
 
1539
1711
  options = {
1540
1712
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1541
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'graphName' => graph_name},
1713
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
1542
1714
  query_params: {'api-version' => @client.api_version},
1543
1715
  headers: request_headers.merge(custom_headers || {}),
1544
1716
  base_url: request_url
1545
1717
  }
1546
- promise = @client.make_request_async(:delete, path_template, options)
1718
+ promise = @client.make_request_async(:post, path_template, options)
1547
1719
 
1548
1720
  promise = promise.then do |result|
1549
1721
  http_response = result.response
1550
1722
  status_code = http_response.status
1551
1723
  response_content = http_response.body
1552
- unless status_code == 202 || status_code == 204
1724
+ unless status_code == 202 || status_code == 200
1553
1725
  error_model = JSON.load(response_content)
1554
1726
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1555
1727
  end
@@ -1557,6 +1729,16 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1557
1729
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1558
1730
  result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1559
1731
  result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1732
+ # Deserialize Response
1733
+ if status_code == 200
1734
+ begin
1735
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1736
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1737
+ result.body = @client.deserialize(result_mapper, parsed_response)
1738
+ rescue Exception => e
1739
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1740
+ end
1741
+ end
1560
1742
 
1561
1743
  result
1562
1744
  end
@@ -1565,35 +1747,267 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1565
1747
  end
1566
1748
 
1567
1749
  #
1568
- # Update RUs per second of an Azure Cosmos DB Gremlin graph
1750
+ # Create or update an Azure Cosmos DB Gremlin graph
1569
1751
  #
1570
1752
  # @param resource_group_name [String] The name of the resource group. The name
1571
1753
  # is case insensitive.
1572
1754
  # @param account_name [String] Cosmos DB database account name.
1573
1755
  # @param database_name [String] Cosmos DB database name.
1574
1756
  # @param graph_name [String] Cosmos DB graph name.
1575
- # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1576
- # RUs per second of the parameters to provide for the current Gremlin graph.
1757
+ # @param create_update_gremlin_graph_parameters
1758
+ # [GremlinGraphCreateUpdateParameters] The parameters to provide for the
1759
+ # current Gremlin graph.
1577
1760
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1578
1761
  # will be added to the HTTP request.
1579
1762
  #
1580
- # @return [ThroughputSettingsGetResults] operation results.
1763
+ # @return [GremlinGraphGetResults] operation results.
1581
1764
  #
1582
- def begin_update_gremlin_graph_throughput(resource_group_name, account_name, database_name, graph_name, update_throughput_parameters, custom_headers:nil)
1583
- response = begin_update_gremlin_graph_throughput_async(resource_group_name, account_name, database_name, graph_name, update_throughput_parameters, custom_headers:custom_headers).value!
1765
+ def begin_create_update_gremlin_graph(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:nil)
1766
+ response = begin_create_update_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:custom_headers).value!
1584
1767
  response.body unless response.nil?
1585
1768
  end
1586
1769
 
1587
1770
  #
1588
- # Update RUs per second of an Azure Cosmos DB Gremlin graph
1771
+ # Create or update an Azure Cosmos DB Gremlin graph
1589
1772
  #
1590
1773
  # @param resource_group_name [String] The name of the resource group. The name
1591
1774
  # is case insensitive.
1592
1775
  # @param account_name [String] Cosmos DB database account name.
1593
1776
  # @param database_name [String] Cosmos DB database name.
1594
1777
  # @param graph_name [String] Cosmos DB graph name.
1595
- # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1596
- # RUs per second of the parameters to provide for the current Gremlin graph.
1778
+ # @param create_update_gremlin_graph_parameters
1779
+ # [GremlinGraphCreateUpdateParameters] The parameters to provide for the
1780
+ # current Gremlin graph.
1781
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1782
+ # will be added to the HTTP request.
1783
+ #
1784
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1785
+ #
1786
+ def begin_create_update_gremlin_graph_with_http_info(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:nil)
1787
+ begin_create_update_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:custom_headers).value!
1788
+ end
1789
+
1790
+ #
1791
+ # Create or update an Azure Cosmos DB Gremlin graph
1792
+ #
1793
+ # @param resource_group_name [String] The name of the resource group. The name
1794
+ # is case insensitive.
1795
+ # @param account_name [String] Cosmos DB database account name.
1796
+ # @param database_name [String] Cosmos DB database name.
1797
+ # @param graph_name [String] Cosmos DB graph name.
1798
+ # @param create_update_gremlin_graph_parameters
1799
+ # [GremlinGraphCreateUpdateParameters] The parameters to provide for the
1800
+ # current Gremlin graph.
1801
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1802
+ # to the HTTP request.
1803
+ #
1804
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1805
+ #
1806
+ def begin_create_update_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, create_update_gremlin_graph_parameters, custom_headers:nil)
1807
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1808
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1809
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1810
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1811
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1812
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1813
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1814
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1815
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1816
+ 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?
1817
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1818
+ fail ArgumentError, 'graph_name is nil' if graph_name.nil?
1819
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1820
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1821
+ fail ArgumentError, 'create_update_gremlin_graph_parameters is nil' if create_update_gremlin_graph_parameters.nil?
1822
+
1823
+
1824
+ request_headers = {}
1825
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1826
+
1827
+ # Set Headers
1828
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1829
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1830
+
1831
+ # Serialize Request
1832
+ request_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::GremlinGraphCreateUpdateParameters.mapper()
1833
+ request_content = @client.serialize(request_mapper, create_update_gremlin_graph_parameters)
1834
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1835
+
1836
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'
1837
+
1838
+ request_url = @base_url || @client.base_url
1839
+
1840
+ options = {
1841
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1842
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'graphName' => graph_name},
1843
+ query_params: {'api-version' => @client.api_version},
1844
+ body: request_content,
1845
+ headers: request_headers.merge(custom_headers || {}),
1846
+ base_url: request_url
1847
+ }
1848
+ promise = @client.make_request_async(:put, path_template, options)
1849
+
1850
+ promise = promise.then do |result|
1851
+ http_response = result.response
1852
+ status_code = http_response.status
1853
+ response_content = http_response.body
1854
+ unless status_code == 202 || status_code == 200
1855
+ error_model = JSON.load(response_content)
1856
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1857
+ end
1858
+
1859
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1860
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1861
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1862
+ # Deserialize Response
1863
+ if status_code == 200
1864
+ begin
1865
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1866
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::GremlinGraphGetResults.mapper()
1867
+ result.body = @client.deserialize(result_mapper, parsed_response)
1868
+ rescue Exception => e
1869
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1870
+ end
1871
+ end
1872
+
1873
+ result
1874
+ end
1875
+
1876
+ promise.execute
1877
+ end
1878
+
1879
+ #
1880
+ # Deletes an existing Azure Cosmos DB Gremlin graph.
1881
+ #
1882
+ # @param resource_group_name [String] The name of the resource group. The name
1883
+ # is case insensitive.
1884
+ # @param account_name [String] Cosmos DB database account name.
1885
+ # @param database_name [String] Cosmos DB database name.
1886
+ # @param graph_name [String] Cosmos DB graph name.
1887
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1888
+ # will be added to the HTTP request.
1889
+ #
1890
+ #
1891
+ def begin_delete_gremlin_graph(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1892
+ response = begin_delete_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
1893
+ nil
1894
+ end
1895
+
1896
+ #
1897
+ # Deletes an existing Azure Cosmos DB Gremlin graph.
1898
+ #
1899
+ # @param resource_group_name [String] The name of the resource group. The name
1900
+ # is case insensitive.
1901
+ # @param account_name [String] Cosmos DB database account name.
1902
+ # @param database_name [String] Cosmos DB database name.
1903
+ # @param graph_name [String] Cosmos DB graph name.
1904
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1905
+ # will be added to the HTTP request.
1906
+ #
1907
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1908
+ #
1909
+ def begin_delete_gremlin_graph_with_http_info(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1910
+ begin_delete_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
1911
+ end
1912
+
1913
+ #
1914
+ # Deletes an existing Azure Cosmos DB Gremlin graph.
1915
+ #
1916
+ # @param resource_group_name [String] The name of the resource group. The name
1917
+ # is case insensitive.
1918
+ # @param account_name [String] Cosmos DB database account name.
1919
+ # @param database_name [String] Cosmos DB database name.
1920
+ # @param graph_name [String] Cosmos DB graph name.
1921
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1922
+ # to the HTTP request.
1923
+ #
1924
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1925
+ #
1926
+ def begin_delete_gremlin_graph_async(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
1927
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1928
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1929
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1930
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1931
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1932
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1933
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1934
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1935
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1936
+ 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?
1937
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1938
+ fail ArgumentError, 'graph_name is nil' if graph_name.nil?
1939
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1940
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1941
+
1942
+
1943
+ request_headers = {}
1944
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1945
+
1946
+ # Set Headers
1947
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1948
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1949
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}'
1950
+
1951
+ request_url = @base_url || @client.base_url
1952
+
1953
+ options = {
1954
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1955
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'graphName' => graph_name},
1956
+ query_params: {'api-version' => @client.api_version},
1957
+ headers: request_headers.merge(custom_headers || {}),
1958
+ base_url: request_url
1959
+ }
1960
+ promise = @client.make_request_async(:delete, path_template, options)
1961
+
1962
+ promise = promise.then do |result|
1963
+ http_response = result.response
1964
+ status_code = http_response.status
1965
+ response_content = http_response.body
1966
+ unless status_code == 202 || status_code == 204
1967
+ error_model = JSON.load(response_content)
1968
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1969
+ end
1970
+
1971
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1972
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1973
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1974
+
1975
+ result
1976
+ end
1977
+
1978
+ promise.execute
1979
+ end
1980
+
1981
+ #
1982
+ # Update RUs per second of an Azure Cosmos DB Gremlin graph
1983
+ #
1984
+ # @param resource_group_name [String] The name of the resource group. The name
1985
+ # is case insensitive.
1986
+ # @param account_name [String] Cosmos DB database account name.
1987
+ # @param database_name [String] Cosmos DB database name.
1988
+ # @param graph_name [String] Cosmos DB graph name.
1989
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1990
+ # RUs per second of the parameters to provide for the current Gremlin graph.
1991
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1992
+ # will be added to the HTTP request.
1993
+ #
1994
+ # @return [ThroughputSettingsGetResults] operation results.
1995
+ #
1996
+ def begin_update_gremlin_graph_throughput(resource_group_name, account_name, database_name, graph_name, update_throughput_parameters, custom_headers:nil)
1997
+ response = begin_update_gremlin_graph_throughput_async(resource_group_name, account_name, database_name, graph_name, update_throughput_parameters, custom_headers:custom_headers).value!
1998
+ response.body unless response.nil?
1999
+ end
2000
+
2001
+ #
2002
+ # Update RUs per second of an Azure Cosmos DB Gremlin graph
2003
+ #
2004
+ # @param resource_group_name [String] The name of the resource group. The name
2005
+ # is case insensitive.
2006
+ # @param account_name [String] Cosmos DB database account name.
2007
+ # @param database_name [String] Cosmos DB database name.
2008
+ # @param graph_name [String] Cosmos DB graph name.
2009
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2010
+ # RUs per second of the parameters to provide for the current Gremlin graph.
1597
2011
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1598
2012
  # will be added to the HTTP request.
1599
2013
  #
@@ -1691,5 +2105,231 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1691
2105
  promise.execute
1692
2106
  end
1693
2107
 
2108
+ #
2109
+ # Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale
2110
+ #
2111
+ # @param resource_group_name [String] The name of the resource group. The name
2112
+ # is case insensitive.
2113
+ # @param account_name [String] Cosmos DB database account name.
2114
+ # @param database_name [String] Cosmos DB database name.
2115
+ # @param graph_name [String] Cosmos DB graph name.
2116
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2117
+ # will be added to the HTTP request.
2118
+ #
2119
+ # @return [ThroughputSettingsGetResults] operation results.
2120
+ #
2121
+ def begin_migrate_gremlin_graph_to_autoscale(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
2122
+ response = begin_migrate_gremlin_graph_to_autoscale_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
2123
+ response.body unless response.nil?
2124
+ end
2125
+
2126
+ #
2127
+ # Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale
2128
+ #
2129
+ # @param resource_group_name [String] The name of the resource group. The name
2130
+ # is case insensitive.
2131
+ # @param account_name [String] Cosmos DB database account name.
2132
+ # @param database_name [String] Cosmos DB database name.
2133
+ # @param graph_name [String] Cosmos DB graph name.
2134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2135
+ # will be added to the HTTP request.
2136
+ #
2137
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2138
+ #
2139
+ def begin_migrate_gremlin_graph_to_autoscale_with_http_info(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
2140
+ begin_migrate_gremlin_graph_to_autoscale_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
2141
+ end
2142
+
2143
+ #
2144
+ # Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale
2145
+ #
2146
+ # @param resource_group_name [String] The name of the resource group. The name
2147
+ # is case insensitive.
2148
+ # @param account_name [String] Cosmos DB database account name.
2149
+ # @param database_name [String] Cosmos DB database name.
2150
+ # @param graph_name [String] Cosmos DB graph name.
2151
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2152
+ # to the HTTP request.
2153
+ #
2154
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2155
+ #
2156
+ def begin_migrate_gremlin_graph_to_autoscale_async(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
2157
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2158
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
2159
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2160
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2161
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2162
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2163
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2164
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2165
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2166
+ 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?
2167
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2168
+ fail ArgumentError, 'graph_name is nil' if graph_name.nil?
2169
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2170
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
2171
+
2172
+
2173
+ request_headers = {}
2174
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2175
+
2176
+ # Set Headers
2177
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2178
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2179
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale'
2180
+
2181
+ request_url = @base_url || @client.base_url
2182
+
2183
+ options = {
2184
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2185
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'graphName' => graph_name},
2186
+ query_params: {'api-version' => @client.api_version},
2187
+ headers: request_headers.merge(custom_headers || {}),
2188
+ base_url: request_url
2189
+ }
2190
+ promise = @client.make_request_async(:post, path_template, options)
2191
+
2192
+ promise = promise.then do |result|
2193
+ http_response = result.response
2194
+ status_code = http_response.status
2195
+ response_content = http_response.body
2196
+ unless status_code == 202 || status_code == 200
2197
+ error_model = JSON.load(response_content)
2198
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2199
+ end
2200
+
2201
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2202
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2203
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2204
+ # Deserialize Response
2205
+ if status_code == 200
2206
+ begin
2207
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2208
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
2209
+ result.body = @client.deserialize(result_mapper, parsed_response)
2210
+ rescue Exception => e
2211
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2212
+ end
2213
+ end
2214
+
2215
+ result
2216
+ end
2217
+
2218
+ promise.execute
2219
+ end
2220
+
2221
+ #
2222
+ # Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput
2223
+ #
2224
+ # @param resource_group_name [String] The name of the resource group. The name
2225
+ # is case insensitive.
2226
+ # @param account_name [String] Cosmos DB database account name.
2227
+ # @param database_name [String] Cosmos DB database name.
2228
+ # @param graph_name [String] Cosmos DB graph name.
2229
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2230
+ # will be added to the HTTP request.
2231
+ #
2232
+ # @return [ThroughputSettingsGetResults] operation results.
2233
+ #
2234
+ def begin_migrate_gremlin_graph_to_manual_throughput(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
2235
+ response = begin_migrate_gremlin_graph_to_manual_throughput_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
2236
+ response.body unless response.nil?
2237
+ end
2238
+
2239
+ #
2240
+ # Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput
2241
+ #
2242
+ # @param resource_group_name [String] The name of the resource group. The name
2243
+ # is case insensitive.
2244
+ # @param account_name [String] Cosmos DB database account name.
2245
+ # @param database_name [String] Cosmos DB database name.
2246
+ # @param graph_name [String] Cosmos DB graph name.
2247
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2248
+ # will be added to the HTTP request.
2249
+ #
2250
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2251
+ #
2252
+ def begin_migrate_gremlin_graph_to_manual_throughput_with_http_info(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
2253
+ begin_migrate_gremlin_graph_to_manual_throughput_async(resource_group_name, account_name, database_name, graph_name, custom_headers:custom_headers).value!
2254
+ end
2255
+
2256
+ #
2257
+ # Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput
2258
+ #
2259
+ # @param resource_group_name [String] The name of the resource group. The name
2260
+ # is case insensitive.
2261
+ # @param account_name [String] Cosmos DB database account name.
2262
+ # @param database_name [String] Cosmos DB database name.
2263
+ # @param graph_name [String] Cosmos DB graph name.
2264
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2265
+ # to the HTTP request.
2266
+ #
2267
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2268
+ #
2269
+ def begin_migrate_gremlin_graph_to_manual_throughput_async(resource_group_name, account_name, database_name, graph_name, custom_headers:nil)
2270
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2271
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
2272
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2273
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2274
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2275
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2276
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2277
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2278
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2279
+ 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?
2280
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2281
+ fail ArgumentError, 'graph_name is nil' if graph_name.nil?
2282
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2283
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
2284
+
2285
+
2286
+ request_headers = {}
2287
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2288
+
2289
+ # Set Headers
2290
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2291
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2292
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput'
2293
+
2294
+ request_url = @base_url || @client.base_url
2295
+
2296
+ options = {
2297
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2298
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'graphName' => graph_name},
2299
+ query_params: {'api-version' => @client.api_version},
2300
+ headers: request_headers.merge(custom_headers || {}),
2301
+ base_url: request_url
2302
+ }
2303
+ promise = @client.make_request_async(:post, path_template, options)
2304
+
2305
+ promise = promise.then do |result|
2306
+ http_response = result.response
2307
+ status_code = http_response.status
2308
+ response_content = http_response.body
2309
+ unless status_code == 202 || status_code == 200
2310
+ error_model = JSON.load(response_content)
2311
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2312
+ end
2313
+
2314
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2315
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2316
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2317
+ # Deserialize Response
2318
+ if status_code == 200
2319
+ begin
2320
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2321
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
2322
+ result.body = @client.deserialize(result_mapper, parsed_response)
2323
+ rescue Exception => e
2324
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2325
+ end
2326
+ end
2327
+
2328
+ result
2329
+ end
2330
+
2331
+ promise.execute
2332
+ end
2333
+
1694
2334
  end
1695
2335
  end