azure_mgmt_cosmosdb 0.21.2 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,99 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Cosmosdb::Mgmt::V2020_04_01
7
+ module Models
8
+ #
9
+ # The CORS policy for the Cosmos DB database account.
10
+ #
11
+ class CorsPolicy
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] The origin domains that are permitted to make a
16
+ # request against the service via CORS.
17
+ attr_accessor :allowed_origins
18
+
19
+ # @return [String] The methods (HTTP request verbs) that the origin
20
+ # domain may use for a CORS request.
21
+ attr_accessor :allowed_methods
22
+
23
+ # @return [String] The request headers that the origin domain may specify
24
+ # on the CORS request.
25
+ attr_accessor :allowed_headers
26
+
27
+ # @return [String] The response headers that may be sent in the response
28
+ # to the CORS request and exposed by the browser to the request issuer.
29
+ attr_accessor :exposed_headers
30
+
31
+ # @return [Integer] The maximum amount time that a browser should cache
32
+ # the preflight OPTIONS request.
33
+ attr_accessor :max_age_in_seconds
34
+
35
+
36
+ #
37
+ # Mapper for CorsPolicy class as Ruby Hash.
38
+ # This will be used for serialization/deserialization.
39
+ #
40
+ def self.mapper()
41
+ {
42
+ client_side_validation: true,
43
+ required: false,
44
+ serialized_name: 'CorsPolicy',
45
+ type: {
46
+ name: 'Composite',
47
+ class_name: 'CorsPolicy',
48
+ model_properties: {
49
+ allowed_origins: {
50
+ client_side_validation: true,
51
+ required: true,
52
+ serialized_name: 'allowedOrigins',
53
+ type: {
54
+ name: 'String'
55
+ }
56
+ },
57
+ allowed_methods: {
58
+ client_side_validation: true,
59
+ required: false,
60
+ serialized_name: 'allowedMethods',
61
+ type: {
62
+ name: 'String'
63
+ }
64
+ },
65
+ allowed_headers: {
66
+ client_side_validation: true,
67
+ required: false,
68
+ serialized_name: 'allowedHeaders',
69
+ type: {
70
+ name: 'String'
71
+ }
72
+ },
73
+ exposed_headers: {
74
+ client_side_validation: true,
75
+ required: false,
76
+ serialized_name: 'exposedHeaders',
77
+ type: {
78
+ name: 'String'
79
+ }
80
+ },
81
+ max_age_in_seconds: {
82
+ client_side_validation: true,
83
+ required: false,
84
+ serialized_name: 'maxAgeInSeconds',
85
+ constraints: {
86
+ InclusiveMaximum: 2147483647,
87
+ InclusiveMinimum: 1
88
+ },
89
+ type: {
90
+ name: 'Number'
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ end
97
+ end
98
+ end
99
+ end
@@ -83,6 +83,10 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
83
83
  # @return [Boolean] Flag to indicate whether to enable storage analytics.
84
84
  attr_accessor :enable_analytical_storage
85
85
 
86
+ # @return [Array<CorsPolicy>] The CORS policy for the Cosmos DB database
87
+ # account.
88
+ attr_accessor :cors
89
+
86
90
 
87
91
  #
88
92
  # Mapper for DatabaseAccountCreateUpdateParameters class as Ruby Hash.
@@ -332,6 +336,23 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
332
336
  type: {
333
337
  name: 'Boolean'
334
338
  }
339
+ },
340
+ cors: {
341
+ client_side_validation: true,
342
+ required: false,
343
+ serialized_name: 'properties.cors',
344
+ type: {
345
+ name: 'Sequence',
346
+ element: {
347
+ client_side_validation: true,
348
+ required: false,
349
+ serialized_name: 'CorsPolicyElementType',
350
+ type: {
351
+ name: 'Composite',
352
+ class_name: 'CorsPolicy'
353
+ }
354
+ }
355
+ }
335
356
  }
336
357
  }
337
358
  }
@@ -106,6 +106,10 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
106
106
  # @return [Boolean] Flag to indicate whether to enable storage analytics.
107
107
  attr_accessor :enable_analytical_storage
108
108
 
109
+ # @return [Array<CorsPolicy>] The CORS policy for the Cosmos DB database
110
+ # account.
111
+ attr_accessor :cors
112
+
109
113
 
110
114
  #
111
115
  # Mapper for DatabaseAccountGetResults class as Ruby Hash.
@@ -445,6 +449,23 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
445
449
  type: {
446
450
  name: 'Boolean'
447
451
  }
452
+ },
453
+ cors: {
454
+ client_side_validation: true,
455
+ required: false,
456
+ serialized_name: 'properties.cors',
457
+ type: {
458
+ name: 'Sequence',
459
+ element: {
460
+ client_side_validation: true,
461
+ required: false,
462
+ serialized_name: 'CorsPolicyElementType',
463
+ type: {
464
+ name: 'Composite',
465
+ class_name: 'CorsPolicy'
466
+ }
467
+ }
468
+ }
448
469
  }
449
470
  }
450
471
  }
@@ -80,6 +80,10 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
80
80
  # @return [Boolean] Flag to indicate whether to enable storage analytics.
81
81
  attr_accessor :enable_analytical_storage
82
82
 
83
+ # @return [Array<CorsPolicy>] The CORS policy for the Cosmos DB database
84
+ # account.
85
+ attr_accessor :cors
86
+
83
87
 
84
88
  #
85
89
  # Mapper for DatabaseAccountUpdateParameters class as Ruby Hash.
@@ -283,6 +287,23 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
283
287
  type: {
284
288
  name: 'Boolean'
285
289
  }
290
+ },
291
+ cors: {
292
+ client_side_validation: true,
293
+ required: false,
294
+ serialized_name: 'properties.cors',
295
+ type: {
296
+ name: 'Sequence',
297
+ element: {
298
+ client_side_validation: true,
299
+ required: false,
300
+ serialized_name: 'CorsPolicyElementType',
301
+ type: {
302
+ name: 'Composite',
303
+ class_name: 'CorsPolicy'
304
+ }
305
+ }
306
+ }
286
307
  }
287
308
  }
288
309
  }
@@ -37,6 +37,9 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
37
37
  # the container.
38
38
  attr_accessor :conflict_resolution_policy
39
39
 
40
+ # @return [Integer] Analytical TTL.
41
+ attr_accessor :analytical_storage_ttl
42
+
40
43
  # @return [String] A system generated property. A unique identifier.
41
44
  attr_accessor :_rid
42
45
 
@@ -114,6 +117,14 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
114
117
  class_name: 'ConflictResolutionPolicy'
115
118
  }
116
119
  },
120
+ analytical_storage_ttl: {
121
+ client_side_validation: true,
122
+ required: false,
123
+ serialized_name: 'analyticalStorageTtl',
124
+ type: {
125
+ name: 'Number'
126
+ }
127
+ },
117
128
  _rid: {
118
129
  client_side_validation: true,
119
130
  required: false,
@@ -36,6 +36,9 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
36
36
  # the container.
37
37
  attr_accessor :conflict_resolution_policy
38
38
 
39
+ # @return [Integer] Analytical TTL.
40
+ attr_accessor :analytical_storage_ttl
41
+
39
42
 
40
43
  #
41
44
  # Mapper for SqlContainerResource class as Ruby Hash.
@@ -101,6 +104,14 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
101
104
  name: 'Composite',
102
105
  class_name: 'ConflictResolutionPolicy'
103
106
  }
107
+ },
108
+ analytical_storage_ttl: {
109
+ client_side_validation: true,
110
+ required: false,
111
+ serialized_name: 'analyticalStorageTtl',
112
+ type: {
113
+ name: 'Number'
114
+ }
104
115
  }
105
116
  }
106
117
  }
@@ -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 MongoDB 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_mongo_dbdatabase_to_autoscale(resource_group_name, account_name, database_name, custom_headers:nil)
514
+ response = migrate_mongo_dbdatabase_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_mongo_dbdatabase_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:nil)
530
+ # Send request
531
+ promise = begin_migrate_mongo_dbdatabase_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 MongoDB 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_mongo_dbdatabase_to_manual_throughput(resource_group_name, account_name, database_name, custom_headers:nil)
561
+ response = migrate_mongo_dbdatabase_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_mongo_dbdatabase_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:nil)
577
+ # Send request
578
+ promise = begin_migrate_mongo_dbdatabase_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 MongoDB collection under an existing Azure Cosmos DB database
502
596
  # account.
@@ -993,6 +1087,104 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
993
1087
  promise
994
1088
  end
995
1089
 
1090
+ #
1091
+ # Migrate an Azure Cosmos DB MongoDB collection from manual throughput to
1092
+ # autoscale
1093
+ #
1094
+ # @param resource_group_name [String] The name of the resource group. The name
1095
+ # is case insensitive.
1096
+ # @param account_name [String] Cosmos DB database account name.
1097
+ # @param database_name [String] Cosmos DB database name.
1098
+ # @param collection_name [String] Cosmos DB collection name.
1099
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1100
+ # will be added to the HTTP request.
1101
+ #
1102
+ # @return [ThroughputSettingsGetResults] operation results.
1103
+ #
1104
+ def migrate_mongo_dbcollection_to_autoscale(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1105
+ response = migrate_mongo_dbcollection_to_autoscale_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
1106
+ response.body unless response.nil?
1107
+ end
1108
+
1109
+ #
1110
+ # @param resource_group_name [String] The name of the resource group. The name
1111
+ # is case insensitive.
1112
+ # @param account_name [String] Cosmos DB database account name.
1113
+ # @param database_name [String] Cosmos DB database name.
1114
+ # @param collection_name [String] Cosmos DB collection name.
1115
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1116
+ # will be added to the HTTP request.
1117
+ #
1118
+ # @return [Concurrent::Promise] promise which provides async access to http
1119
+ # response.
1120
+ #
1121
+ def migrate_mongo_dbcollection_to_autoscale_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1122
+ # Send request
1123
+ promise = begin_migrate_mongo_dbcollection_to_autoscale_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers)
1124
+
1125
+ promise = promise.then do |response|
1126
+ # Defining deserialization method.
1127
+ deserialize_method = lambda do |parsed_response|
1128
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1129
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1130
+ end
1131
+
1132
+ # Waiting for response.
1133
+ @client.get_long_running_operation_result(response, deserialize_method)
1134
+ end
1135
+
1136
+ promise
1137
+ end
1138
+
1139
+ #
1140
+ # Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual
1141
+ # throughput
1142
+ #
1143
+ # @param resource_group_name [String] The name of the resource group. The name
1144
+ # is case insensitive.
1145
+ # @param account_name [String] Cosmos DB database account name.
1146
+ # @param database_name [String] Cosmos DB database name.
1147
+ # @param collection_name [String] Cosmos DB collection name.
1148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1149
+ # will be added to the HTTP request.
1150
+ #
1151
+ # @return [ThroughputSettingsGetResults] operation results.
1152
+ #
1153
+ def migrate_mongo_dbcollection_to_manual_throughput(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1154
+ response = migrate_mongo_dbcollection_to_manual_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
1155
+ response.body unless response.nil?
1156
+ end
1157
+
1158
+ #
1159
+ # @param resource_group_name [String] The name of the resource group. The name
1160
+ # is case insensitive.
1161
+ # @param account_name [String] Cosmos DB database account name.
1162
+ # @param database_name [String] Cosmos DB database name.
1163
+ # @param collection_name [String] Cosmos DB collection name.
1164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1165
+ # will be added to the HTTP request.
1166
+ #
1167
+ # @return [Concurrent::Promise] promise which provides async access to http
1168
+ # response.
1169
+ #
1170
+ def migrate_mongo_dbcollection_to_manual_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1171
+ # Send request
1172
+ promise = begin_migrate_mongo_dbcollection_to_manual_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers)
1173
+
1174
+ promise = promise.then do |response|
1175
+ # Defining deserialization method.
1176
+ deserialize_method = lambda do |parsed_response|
1177
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1178
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1179
+ end
1180
+
1181
+ # Waiting for response.
1182
+ @client.get_long_running_operation_result(response, deserialize_method)
1183
+ end
1184
+
1185
+ promise
1186
+ end
1187
+
996
1188
  #
997
1189
  # Create or updates Azure Cosmos DB MongoDB database
998
1190
  #
@@ -1341,63 +1533,54 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1341
1533
  end
1342
1534
 
1343
1535
  #
1344
- # Create or update an Azure Cosmos DB MongoDB Collection
1536
+ # Migrate an Azure Cosmos DB MongoDB database from manual throughput to
1537
+ # autoscale
1345
1538
  #
1346
1539
  # @param resource_group_name [String] The name of the resource group. The name
1347
1540
  # is case insensitive.
1348
1541
  # @param account_name [String] Cosmos DB database account name.
1349
1542
  # @param database_name [String] Cosmos DB database name.
1350
- # @param collection_name [String] Cosmos DB collection name.
1351
- # @param create_update_mongo_dbcollection_parameters
1352
- # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1353
- # current MongoDB Collection.
1354
1543
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1355
1544
  # will be added to the HTTP request.
1356
1545
  #
1357
- # @return [MongoDBCollectionGetResults] operation results.
1546
+ # @return [ThroughputSettingsGetResults] operation results.
1358
1547
  #
1359
- def begin_create_update_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1360
- response = begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:custom_headers).value!
1548
+ def begin_migrate_mongo_dbdatabase_to_autoscale(resource_group_name, account_name, database_name, custom_headers:nil)
1549
+ response = begin_migrate_mongo_dbdatabase_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1361
1550
  response.body unless response.nil?
1362
1551
  end
1363
1552
 
1364
1553
  #
1365
- # Create or update an Azure Cosmos DB MongoDB Collection
1554
+ # Migrate an Azure Cosmos DB MongoDB database from manual throughput to
1555
+ # autoscale
1366
1556
  #
1367
1557
  # @param resource_group_name [String] The name of the resource group. The name
1368
1558
  # is case insensitive.
1369
1559
  # @param account_name [String] Cosmos DB database account name.
1370
1560
  # @param database_name [String] Cosmos DB database name.
1371
- # @param collection_name [String] Cosmos DB collection name.
1372
- # @param create_update_mongo_dbcollection_parameters
1373
- # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1374
- # current MongoDB Collection.
1375
1561
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1376
1562
  # will be added to the HTTP request.
1377
1563
  #
1378
1564
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1379
1565
  #
1380
- def begin_create_update_mongo_dbcollection_with_http_info(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1381
- begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:custom_headers).value!
1566
+ def begin_migrate_mongo_dbdatabase_to_autoscale_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
1567
+ begin_migrate_mongo_dbdatabase_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1382
1568
  end
1383
1569
 
1384
1570
  #
1385
- # Create or update an Azure Cosmos DB MongoDB Collection
1571
+ # Migrate an Azure Cosmos DB MongoDB database from manual throughput to
1572
+ # autoscale
1386
1573
  #
1387
1574
  # @param resource_group_name [String] The name of the resource group. The name
1388
1575
  # is case insensitive.
1389
1576
  # @param account_name [String] Cosmos DB database account name.
1390
1577
  # @param database_name [String] Cosmos DB database name.
1391
- # @param collection_name [String] Cosmos DB collection name.
1392
- # @param create_update_mongo_dbcollection_parameters
1393
- # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1394
- # current MongoDB Collection.
1395
1578
  # @param [Hash{String => String}] A hash of custom headers that will be added
1396
1579
  # to the HTTP request.
1397
1580
  #
1398
1581
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1399
1582
  #
1400
- def begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1583
+ def begin_migrate_mongo_dbdatabase_to_autoscale_async(resource_group_name, account_name, database_name, custom_headers:nil)
1401
1584
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1402
1585
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1403
1586
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
@@ -1409,10 +1592,8 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1409
1592
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1410
1593
  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?
1411
1594
  fail ArgumentError, 'database_name is nil' if database_name.nil?
1412
- fail ArgumentError, 'collection_name is nil' if collection_name.nil?
1413
1595
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1414
1596
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1415
- fail ArgumentError, 'create_update_mongo_dbcollection_parameters is nil' if create_update_mongo_dbcollection_parameters.nil?
1416
1597
 
1417
1598
 
1418
1599
  request_headers = {}
@@ -1421,25 +1602,18 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1421
1602
  # Set Headers
1422
1603
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1423
1604
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1424
-
1425
- # Serialize Request
1426
- request_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::MongoDBCollectionCreateUpdateParameters.mapper()
1427
- request_content = @client.serialize(request_mapper, create_update_mongo_dbcollection_parameters)
1428
- request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1429
-
1430
- path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'
1605
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale'
1431
1606
 
1432
1607
  request_url = @base_url || @client.base_url
1433
1608
 
1434
1609
  options = {
1435
1610
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1436
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
1611
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
1437
1612
  query_params: {'api-version' => @client.api_version},
1438
- body: request_content,
1439
1613
  headers: request_headers.merge(custom_headers || {}),
1440
1614
  base_url: request_url
1441
1615
  }
1442
- promise = @client.make_request_async(:put, path_template, options)
1616
+ promise = @client.make_request_async(:post, path_template, options)
1443
1617
 
1444
1618
  promise = promise.then do |result|
1445
1619
  http_response = result.response
@@ -1457,7 +1631,7 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1457
1631
  if status_code == 200
1458
1632
  begin
1459
1633
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1460
- result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::MongoDBCollectionGetResults.mapper()
1634
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1461
1635
  result.body = @client.deserialize(result_mapper, parsed_response)
1462
1636
  rescue Exception => e
1463
1637
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -1471,53 +1645,54 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1471
1645
  end
1472
1646
 
1473
1647
  #
1474
- # Deletes an existing Azure Cosmos DB MongoDB Collection.
1648
+ # Migrate an Azure Cosmos DB MongoDB database from autoscale to manual
1649
+ # throughput
1475
1650
  #
1476
1651
  # @param resource_group_name [String] The name of the resource group. The name
1477
1652
  # is case insensitive.
1478
1653
  # @param account_name [String] Cosmos DB database account name.
1479
1654
  # @param database_name [String] Cosmos DB database name.
1480
- # @param collection_name [String] Cosmos DB collection name.
1481
1655
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1482
1656
  # will be added to the HTTP request.
1483
1657
  #
1658
+ # @return [ThroughputSettingsGetResults] operation results.
1484
1659
  #
1485
- def begin_delete_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1486
- response = begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
1487
- nil
1660
+ def begin_migrate_mongo_dbdatabase_to_manual_throughput(resource_group_name, account_name, database_name, custom_headers:nil)
1661
+ response = begin_migrate_mongo_dbdatabase_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1662
+ response.body unless response.nil?
1488
1663
  end
1489
1664
 
1490
1665
  #
1491
- # Deletes an existing Azure Cosmos DB MongoDB Collection.
1666
+ # Migrate an Azure Cosmos DB MongoDB database from autoscale to manual
1667
+ # throughput
1492
1668
  #
1493
1669
  # @param resource_group_name [String] The name of the resource group. The name
1494
1670
  # is case insensitive.
1495
1671
  # @param account_name [String] Cosmos DB database account name.
1496
1672
  # @param database_name [String] Cosmos DB database name.
1497
- # @param collection_name [String] Cosmos DB collection name.
1498
1673
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1499
1674
  # will be added to the HTTP request.
1500
1675
  #
1501
1676
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1502
1677
  #
1503
- def begin_delete_mongo_dbcollection_with_http_info(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1504
- begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
1678
+ def begin_migrate_mongo_dbdatabase_to_manual_throughput_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
1679
+ begin_migrate_mongo_dbdatabase_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1505
1680
  end
1506
1681
 
1507
1682
  #
1508
- # Deletes an existing Azure Cosmos DB MongoDB Collection.
1683
+ # Migrate an Azure Cosmos DB MongoDB database from autoscale to manual
1684
+ # throughput
1509
1685
  #
1510
1686
  # @param resource_group_name [String] The name of the resource group. The name
1511
1687
  # is case insensitive.
1512
1688
  # @param account_name [String] Cosmos DB database account name.
1513
1689
  # @param database_name [String] Cosmos DB database name.
1514
- # @param collection_name [String] Cosmos DB collection name.
1515
1690
  # @param [Hash{String => String}] A hash of custom headers that will be added
1516
1691
  # to the HTTP request.
1517
1692
  #
1518
1693
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1519
1694
  #
1520
- def begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1695
+ def begin_migrate_mongo_dbdatabase_to_manual_throughput_async(resource_group_name, account_name, database_name, custom_headers:nil)
1521
1696
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1522
1697
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1523
1698
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
@@ -1529,7 +1704,6 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1529
1704
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1530
1705
  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?
1531
1706
  fail ArgumentError, 'database_name is nil' if database_name.nil?
1532
- fail ArgumentError, 'collection_name is nil' if collection_name.nil?
1533
1707
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1534
1708
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1535
1709
 
@@ -1540,24 +1714,24 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1540
1714
  # Set Headers
1541
1715
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1542
1716
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1543
- path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'
1717
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput'
1544
1718
 
1545
1719
  request_url = @base_url || @client.base_url
1546
1720
 
1547
1721
  options = {
1548
1722
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1549
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
1723
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
1550
1724
  query_params: {'api-version' => @client.api_version},
1551
1725
  headers: request_headers.merge(custom_headers || {}),
1552
1726
  base_url: request_url
1553
1727
  }
1554
- promise = @client.make_request_async(:delete, path_template, options)
1728
+ promise = @client.make_request_async(:post, path_template, options)
1555
1729
 
1556
1730
  promise = promise.then do |result|
1557
1731
  http_response = result.response
1558
1732
  status_code = http_response.status
1559
1733
  response_content = http_response.body
1560
- unless status_code == 202 || status_code == 204
1734
+ unless status_code == 202 || status_code == 200
1561
1735
  error_model = JSON.load(response_content)
1562
1736
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1563
1737
  end
@@ -1565,6 +1739,16 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1565
1739
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1566
1740
  result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1567
1741
  result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1742
+ # Deserialize Response
1743
+ if status_code == 200
1744
+ begin
1745
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1746
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
1747
+ result.body = @client.deserialize(result_mapper, parsed_response)
1748
+ rescue Exception => e
1749
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1750
+ end
1751
+ end
1568
1752
 
1569
1753
  result
1570
1754
  end
@@ -1573,38 +1757,270 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1573
1757
  end
1574
1758
 
1575
1759
  #
1576
- # Update the RUs per second of an Azure Cosmos DB MongoDB collection
1760
+ # Create or update an Azure Cosmos DB MongoDB Collection
1577
1761
  #
1578
1762
  # @param resource_group_name [String] The name of the resource group. The name
1579
1763
  # is case insensitive.
1580
1764
  # @param account_name [String] Cosmos DB database account name.
1581
1765
  # @param database_name [String] Cosmos DB database name.
1582
1766
  # @param collection_name [String] Cosmos DB collection name.
1583
- # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1584
- # RUs per second of the parameters to provide for the current MongoDB
1585
- # collection.
1767
+ # @param create_update_mongo_dbcollection_parameters
1768
+ # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1769
+ # current MongoDB Collection.
1586
1770
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1587
1771
  # will be added to the HTTP request.
1588
1772
  #
1589
- # @return [ThroughputSettingsGetResults] operation results.
1773
+ # @return [MongoDBCollectionGetResults] operation results.
1590
1774
  #
1591
- def begin_update_mongo_dbcollection_throughput(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:nil)
1592
- response = begin_update_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:custom_headers).value!
1775
+ def begin_create_update_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1776
+ response = begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:custom_headers).value!
1593
1777
  response.body unless response.nil?
1594
1778
  end
1595
1779
 
1596
1780
  #
1597
- # Update the RUs per second of an Azure Cosmos DB MongoDB collection
1781
+ # Create or update an Azure Cosmos DB MongoDB Collection
1598
1782
  #
1599
1783
  # @param resource_group_name [String] The name of the resource group. The name
1600
1784
  # is case insensitive.
1601
1785
  # @param account_name [String] Cosmos DB database account name.
1602
1786
  # @param database_name [String] Cosmos DB database name.
1603
1787
  # @param collection_name [String] Cosmos DB collection name.
1604
- # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1605
- # RUs per second of the parameters to provide for the current MongoDB
1606
- # collection.
1607
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
1788
+ # @param create_update_mongo_dbcollection_parameters
1789
+ # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1790
+ # current MongoDB Collection.
1791
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1792
+ # will be added to the HTTP request.
1793
+ #
1794
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1795
+ #
1796
+ def begin_create_update_mongo_dbcollection_with_http_info(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1797
+ begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:custom_headers).value!
1798
+ end
1799
+
1800
+ #
1801
+ # Create or update an Azure Cosmos DB MongoDB Collection
1802
+ #
1803
+ # @param resource_group_name [String] The name of the resource group. The name
1804
+ # is case insensitive.
1805
+ # @param account_name [String] Cosmos DB database account name.
1806
+ # @param database_name [String] Cosmos DB database name.
1807
+ # @param collection_name [String] Cosmos DB collection name.
1808
+ # @param create_update_mongo_dbcollection_parameters
1809
+ # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1810
+ # current MongoDB Collection.
1811
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1812
+ # to the HTTP request.
1813
+ #
1814
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1815
+ #
1816
+ def begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1817
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1818
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1819
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1820
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1821
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1822
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1823
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1824
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1825
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1826
+ 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?
1827
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1828
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
1829
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1830
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1831
+ fail ArgumentError, 'create_update_mongo_dbcollection_parameters is nil' if create_update_mongo_dbcollection_parameters.nil?
1832
+
1833
+
1834
+ request_headers = {}
1835
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1836
+
1837
+ # Set Headers
1838
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1839
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1840
+
1841
+ # Serialize Request
1842
+ request_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::MongoDBCollectionCreateUpdateParameters.mapper()
1843
+ request_content = @client.serialize(request_mapper, create_update_mongo_dbcollection_parameters)
1844
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1845
+
1846
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'
1847
+
1848
+ request_url = @base_url || @client.base_url
1849
+
1850
+ options = {
1851
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1852
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
1853
+ query_params: {'api-version' => @client.api_version},
1854
+ body: request_content,
1855
+ headers: request_headers.merge(custom_headers || {}),
1856
+ base_url: request_url
1857
+ }
1858
+ promise = @client.make_request_async(:put, path_template, options)
1859
+
1860
+ promise = promise.then do |result|
1861
+ http_response = result.response
1862
+ status_code = http_response.status
1863
+ response_content = http_response.body
1864
+ unless status_code == 202 || status_code == 200
1865
+ error_model = JSON.load(response_content)
1866
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1867
+ end
1868
+
1869
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1870
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1871
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1872
+ # Deserialize Response
1873
+ if status_code == 200
1874
+ begin
1875
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1876
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::MongoDBCollectionGetResults.mapper()
1877
+ result.body = @client.deserialize(result_mapper, parsed_response)
1878
+ rescue Exception => e
1879
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1880
+ end
1881
+ end
1882
+
1883
+ result
1884
+ end
1885
+
1886
+ promise.execute
1887
+ end
1888
+
1889
+ #
1890
+ # Deletes an existing Azure Cosmos DB MongoDB Collection.
1891
+ #
1892
+ # @param resource_group_name [String] The name of the resource group. The name
1893
+ # is case insensitive.
1894
+ # @param account_name [String] Cosmos DB database account name.
1895
+ # @param database_name [String] Cosmos DB database name.
1896
+ # @param collection_name [String] Cosmos DB collection name.
1897
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1898
+ # will be added to the HTTP request.
1899
+ #
1900
+ #
1901
+ def begin_delete_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1902
+ response = begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
1903
+ nil
1904
+ end
1905
+
1906
+ #
1907
+ # Deletes an existing Azure Cosmos DB MongoDB Collection.
1908
+ #
1909
+ # @param resource_group_name [String] The name of the resource group. The name
1910
+ # is case insensitive.
1911
+ # @param account_name [String] Cosmos DB database account name.
1912
+ # @param database_name [String] Cosmos DB database name.
1913
+ # @param collection_name [String] Cosmos DB collection name.
1914
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1915
+ # will be added to the HTTP request.
1916
+ #
1917
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1918
+ #
1919
+ def begin_delete_mongo_dbcollection_with_http_info(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1920
+ begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
1921
+ end
1922
+
1923
+ #
1924
+ # Deletes an existing Azure Cosmos DB MongoDB Collection.
1925
+ #
1926
+ # @param resource_group_name [String] The name of the resource group. The name
1927
+ # is case insensitive.
1928
+ # @param account_name [String] Cosmos DB database account name.
1929
+ # @param database_name [String] Cosmos DB database name.
1930
+ # @param collection_name [String] Cosmos DB collection name.
1931
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1932
+ # to the HTTP request.
1933
+ #
1934
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1935
+ #
1936
+ def begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1937
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1938
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1939
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1940
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1941
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1942
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1943
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1944
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1945
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1946
+ 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?
1947
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1948
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
1949
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1950
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1951
+
1952
+
1953
+ request_headers = {}
1954
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1955
+
1956
+ # Set Headers
1957
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1958
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1959
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'
1960
+
1961
+ request_url = @base_url || @client.base_url
1962
+
1963
+ options = {
1964
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1965
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
1966
+ query_params: {'api-version' => @client.api_version},
1967
+ headers: request_headers.merge(custom_headers || {}),
1968
+ base_url: request_url
1969
+ }
1970
+ promise = @client.make_request_async(:delete, path_template, options)
1971
+
1972
+ promise = promise.then do |result|
1973
+ http_response = result.response
1974
+ status_code = http_response.status
1975
+ response_content = http_response.body
1976
+ unless status_code == 202 || status_code == 204
1977
+ error_model = JSON.load(response_content)
1978
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1979
+ end
1980
+
1981
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1982
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1983
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1984
+
1985
+ result
1986
+ end
1987
+
1988
+ promise.execute
1989
+ end
1990
+
1991
+ #
1992
+ # Update the RUs per second of an Azure Cosmos DB MongoDB collection
1993
+ #
1994
+ # @param resource_group_name [String] The name of the resource group. The name
1995
+ # is case insensitive.
1996
+ # @param account_name [String] Cosmos DB database account name.
1997
+ # @param database_name [String] Cosmos DB database name.
1998
+ # @param collection_name [String] Cosmos DB collection name.
1999
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2000
+ # RUs per second of the parameters to provide for the current MongoDB
2001
+ # collection.
2002
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2003
+ # will be added to the HTTP request.
2004
+ #
2005
+ # @return [ThroughputSettingsGetResults] operation results.
2006
+ #
2007
+ def begin_update_mongo_dbcollection_throughput(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:nil)
2008
+ response = begin_update_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:custom_headers).value!
2009
+ response.body unless response.nil?
2010
+ end
2011
+
2012
+ #
2013
+ # Update the RUs per second of an Azure Cosmos DB MongoDB collection
2014
+ #
2015
+ # @param resource_group_name [String] The name of the resource group. The name
2016
+ # is case insensitive.
2017
+ # @param account_name [String] Cosmos DB database account name.
2018
+ # @param database_name [String] Cosmos DB database name.
2019
+ # @param collection_name [String] Cosmos DB collection name.
2020
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2021
+ # RUs per second of the parameters to provide for the current MongoDB
2022
+ # collection.
2023
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1608
2024
  # will be added to the HTTP request.
1609
2025
  #
1610
2026
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
@@ -1702,5 +2118,237 @@ module Azure::Cosmosdb::Mgmt::V2020_04_01
1702
2118
  promise.execute
1703
2119
  end
1704
2120
 
2121
+ #
2122
+ # Migrate an Azure Cosmos DB MongoDB collection from manual throughput to
2123
+ # autoscale
2124
+ #
2125
+ # @param resource_group_name [String] The name of the resource group. The name
2126
+ # is case insensitive.
2127
+ # @param account_name [String] Cosmos DB database account name.
2128
+ # @param database_name [String] Cosmos DB database name.
2129
+ # @param collection_name [String] Cosmos DB collection name.
2130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2131
+ # will be added to the HTTP request.
2132
+ #
2133
+ # @return [ThroughputSettingsGetResults] operation results.
2134
+ #
2135
+ def begin_migrate_mongo_dbcollection_to_autoscale(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
2136
+ response = begin_migrate_mongo_dbcollection_to_autoscale_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
2137
+ response.body unless response.nil?
2138
+ end
2139
+
2140
+ #
2141
+ # Migrate an Azure Cosmos DB MongoDB collection from manual throughput to
2142
+ # autoscale
2143
+ #
2144
+ # @param resource_group_name [String] The name of the resource group. The name
2145
+ # is case insensitive.
2146
+ # @param account_name [String] Cosmos DB database account name.
2147
+ # @param database_name [String] Cosmos DB database name.
2148
+ # @param collection_name [String] Cosmos DB collection name.
2149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2150
+ # will be added to the HTTP request.
2151
+ #
2152
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2153
+ #
2154
+ def begin_migrate_mongo_dbcollection_to_autoscale_with_http_info(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
2155
+ begin_migrate_mongo_dbcollection_to_autoscale_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
2156
+ end
2157
+
2158
+ #
2159
+ # Migrate an Azure Cosmos DB MongoDB collection from manual throughput to
2160
+ # autoscale
2161
+ #
2162
+ # @param resource_group_name [String] The name of the resource group. The name
2163
+ # is case insensitive.
2164
+ # @param account_name [String] Cosmos DB database account name.
2165
+ # @param database_name [String] Cosmos DB database name.
2166
+ # @param collection_name [String] Cosmos DB collection name.
2167
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2168
+ # to the HTTP request.
2169
+ #
2170
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2171
+ #
2172
+ def begin_migrate_mongo_dbcollection_to_autoscale_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
2173
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2174
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
2175
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2176
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2177
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2178
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2179
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2180
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2181
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2182
+ 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?
2183
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2184
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
2185
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2186
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
2187
+
2188
+
2189
+ request_headers = {}
2190
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2191
+
2192
+ # Set Headers
2193
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2194
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2195
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale'
2196
+
2197
+ request_url = @base_url || @client.base_url
2198
+
2199
+ options = {
2200
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2201
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
2202
+ query_params: {'api-version' => @client.api_version},
2203
+ headers: request_headers.merge(custom_headers || {}),
2204
+ base_url: request_url
2205
+ }
2206
+ promise = @client.make_request_async(:post, path_template, options)
2207
+
2208
+ promise = promise.then do |result|
2209
+ http_response = result.response
2210
+ status_code = http_response.status
2211
+ response_content = http_response.body
2212
+ unless status_code == 202 || status_code == 200
2213
+ error_model = JSON.load(response_content)
2214
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2215
+ end
2216
+
2217
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2218
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2219
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2220
+ # Deserialize Response
2221
+ if status_code == 200
2222
+ begin
2223
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2224
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
2225
+ result.body = @client.deserialize(result_mapper, parsed_response)
2226
+ rescue Exception => e
2227
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2228
+ end
2229
+ end
2230
+
2231
+ result
2232
+ end
2233
+
2234
+ promise.execute
2235
+ end
2236
+
2237
+ #
2238
+ # Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual
2239
+ # throughput
2240
+ #
2241
+ # @param resource_group_name [String] The name of the resource group. The name
2242
+ # is case insensitive.
2243
+ # @param account_name [String] Cosmos DB database account name.
2244
+ # @param database_name [String] Cosmos DB database name.
2245
+ # @param collection_name [String] Cosmos DB collection name.
2246
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2247
+ # will be added to the HTTP request.
2248
+ #
2249
+ # @return [ThroughputSettingsGetResults] operation results.
2250
+ #
2251
+ def begin_migrate_mongo_dbcollection_to_manual_throughput(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
2252
+ response = begin_migrate_mongo_dbcollection_to_manual_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
2253
+ response.body unless response.nil?
2254
+ end
2255
+
2256
+ #
2257
+ # Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual
2258
+ # throughput
2259
+ #
2260
+ # @param resource_group_name [String] The name of the resource group. The name
2261
+ # is case insensitive.
2262
+ # @param account_name [String] Cosmos DB database account name.
2263
+ # @param database_name [String] Cosmos DB database name.
2264
+ # @param collection_name [String] Cosmos DB collection name.
2265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2266
+ # will be added to the HTTP request.
2267
+ #
2268
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2269
+ #
2270
+ def begin_migrate_mongo_dbcollection_to_manual_throughput_with_http_info(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
2271
+ begin_migrate_mongo_dbcollection_to_manual_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
2272
+ end
2273
+
2274
+ #
2275
+ # Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual
2276
+ # throughput
2277
+ #
2278
+ # @param resource_group_name [String] The name of the resource group. The name
2279
+ # is case insensitive.
2280
+ # @param account_name [String] Cosmos DB database account name.
2281
+ # @param database_name [String] Cosmos DB database name.
2282
+ # @param collection_name [String] Cosmos DB collection name.
2283
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2284
+ # to the HTTP request.
2285
+ #
2286
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2287
+ #
2288
+ def begin_migrate_mongo_dbcollection_to_manual_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
2289
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2290
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
2291
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2292
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2293
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2294
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2295
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2296
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2297
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2298
+ 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?
2299
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2300
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
2301
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2302
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
2303
+
2304
+
2305
+ request_headers = {}
2306
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2307
+
2308
+ # Set Headers
2309
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2310
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2311
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput'
2312
+
2313
+ request_url = @base_url || @client.base_url
2314
+
2315
+ options = {
2316
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2317
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
2318
+ query_params: {'api-version' => @client.api_version},
2319
+ headers: request_headers.merge(custom_headers || {}),
2320
+ base_url: request_url
2321
+ }
2322
+ promise = @client.make_request_async(:post, path_template, options)
2323
+
2324
+ promise = promise.then do |result|
2325
+ http_response = result.response
2326
+ status_code = http_response.status
2327
+ response_content = http_response.body
2328
+ unless status_code == 202 || status_code == 200
2329
+ error_model = JSON.load(response_content)
2330
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2331
+ end
2332
+
2333
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2334
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2335
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2336
+ # Deserialize Response
2337
+ if status_code == 200
2338
+ begin
2339
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2340
+ result_mapper = Azure::Cosmosdb::Mgmt::V2020_04_01::Models::ThroughputSettingsGetResults.mapper()
2341
+ result.body = @client.deserialize(result_mapper, parsed_response)
2342
+ rescue Exception => e
2343
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2344
+ end
2345
+ end
2346
+
2347
+ result
2348
+ end
2349
+
2350
+ promise.execute
2351
+ end
2352
+
1705
2353
  end
1706
2354
  end