Skip to content

Commit 8609ef5

Browse files
[CosmosDB] az cosmosdb fleet: Update GA contract (#9395)
* Changed version number * Generated python SDK * Add test and update documentation for IsDefaultBucket * Successful recordings * Update and record throughput bucketing test * Garnet issues fixed * Fleet contract updated * Flake 8 * Live_only tests due to missing role assignments * Mongo cluster tests working * Corrected live_only * Corrected HISTORY entries * Remaining recordings * Bug fix * Remaining role issue - live_only * Correct bucketing test recording * Updated versioning --------- Co-authored-by: Achint Agrawal <[email protected]>
1 parent a3db5a5 commit 8609ef5

File tree

189 files changed

+29652
-53424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+29652
-53424
lines changed

src/cosmosdb-preview/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Release History
33
===============
44

5+
1.6.2
6+
* Added throughput bucketing.
7+
+++++++
8+
59
1.6.1
610
+++++
711
* Fix SQL container throughput update to preserve existing throughput buckets when not explicitly specified.

src/cosmosdb-preview/azext_cosmosdb_preview/_params.py

Lines changed: 870 additions & 870 deletions
Large diffs are not rendered by default.

src/cosmosdb-preview/azext_cosmosdb_preview/_validators.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ def validate_fleetspace_body(cmd, ns):
452452
if not isinstance(tp_config, dict):
453453
raise InvalidArgumentValueError('Missing or invalid "throughputPoolConfiguration" in properties.')
454454

455-
for field in ['minThroughput', 'maxThroughput', 'serviceTier', 'dataRegions']:
455+
# Check for minThroughput and maxThroughput in throughputPoolConfiguration
456+
for field in ['minThroughput', 'maxThroughput']:
456457
if field not in tp_config:
457458
raise InvalidArgumentValueError(f'Missing "{field}" in throughputPoolConfiguration.')
458459

@@ -462,11 +463,14 @@ def validate_fleetspace_body(cmd, ns):
462463
if not isinstance(tp_config['maxThroughput'], int) or tp_config['maxThroughput'] <= 0:
463464
raise InvalidArgumentValueError('"maxThroughput" must be a positive integer.')
464465

465-
if not isinstance(tp_config['serviceTier'], str):
466-
raise InvalidArgumentValueError('"serviceTier" must be a string.')
466+
# Check for serviceTier and dataRegions at base properties level
467+
if 'serviceTier' in props:
468+
if not isinstance(props['serviceTier'], str):
469+
raise InvalidArgumentValueError('"serviceTier" must be a string.')
467470

468-
if not isinstance(tp_config['dataRegions'], list) or not all(isinstance(r, str) for r in tp_config['dataRegions']):
469-
raise InvalidArgumentValueError('"dataRegions" must be a list of strings.')
471+
if 'dataRegions' in props:
472+
if not isinstance(props['dataRegions'], list) or not all(isinstance(r, str) for r in props['dataRegions']):
473+
raise InvalidArgumentValueError('"dataRegions" must be a list of strings.')
470474

471475
ns.fleetspace_body = body
472476

src/cosmosdb-preview/azext_cosmosdb_preview/custom.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3305,23 +3305,33 @@ def cli_cosmosdb_fleetspace_create(client,
33053305

33063306
"""Creates an Azure Cosmos DB Fleetspace."""
33073307

3308+
# Extract service_tier and data_regions from base level (mandatory for create)
3309+
service_tier = fleetspace_body['properties'].get('serviceTier')
3310+
data_regions = fleetspace_body['properties'].get('dataRegions')
3311+
3312+
if not service_tier:
3313+
raise CLIError('Missing required field "serviceTier" in properties.')
3314+
3315+
if not data_regions:
3316+
raise CLIError('Missing required field "dataRegions" in properties.')
3317+
33083318
throughput_pool_config = FleetspacePropertiesThroughputPoolConfiguration(
33093319
min_throughput=fleetspace_body['properties']['throughputPoolConfiguration']['minThroughput'],
3310-
max_throughput=fleetspace_body['properties']['throughputPoolConfiguration']['maxThroughput'],
3311-
service_tier=fleetspace_body['properties']['throughputPoolConfiguration']['serviceTier'],
3312-
data_regions=fleetspace_body['properties']['throughputPoolConfiguration']['dataRegions']
3320+
max_throughput=fleetspace_body['properties']['throughputPoolConfiguration']['maxThroughput']
33133321
)
33143322

3315-
fleetspace_body = FleetspaceResource(
3323+
fleetspace_resource = FleetspaceResource(
33163324
fleetspace_api_kind="NoSQL",
3317-
throughput_pool_configuration=throughput_pool_config
3325+
throughput_pool_configuration=throughput_pool_config,
3326+
service_tier=service_tier,
3327+
data_regions=data_regions
33183328
)
33193329

33203330
return client.begin_create(
33213331
resource_group_name=resource_group_name,
33223332
fleet_name=fleet_name,
33233333
fleetspace_name=fleetspace_name,
3324-
body=fleetspace_body
3334+
body=fleetspace_resource
33253335
)
33263336

33273337

@@ -3333,22 +3343,27 @@ def cli_cosmosdb_fleetspace_update(client,
33333343

33343344
"""Updates an existing Azure Cosmos DB Fleetspace."""
33353345

3346+
# Extract service_tier and data_regions from base level (optional for update)
3347+
service_tier = fleetspace_body['properties'].get('serviceTier')
3348+
data_regions = fleetspace_body['properties'].get('dataRegions')
3349+
33363350
throughput_pool_config = FleetspacePropertiesThroughputPoolConfiguration(
33373351
min_throughput=fleetspace_body['properties']['throughputPoolConfiguration']['minThroughput'],
3338-
max_throughput=fleetspace_body['properties']['throughputPoolConfiguration']['maxThroughput'],
3339-
service_tier=fleetspace_body['properties']['throughputPoolConfiguration']['serviceTier']
3352+
max_throughput=fleetspace_body['properties']['throughputPoolConfiguration']['maxThroughput']
33403353
)
33413354

3342-
fleetspace_body = FleetspaceResource(
3355+
fleetspace_resource = FleetspaceResource(
33433356
fleetspace_api_kind="NoSQL",
3344-
throughput_pool_configuration=throughput_pool_config
3357+
throughput_pool_configuration=throughput_pool_config,
3358+
service_tier=service_tier,
3359+
data_regions=data_regions
33453360
)
33463361

33473362
return client.begin_update(
33483363
resource_group_name=resource_group_name,
33493364
fleet_name=fleet_name,
33503365
fleetspace_name=fleetspace_name,
3351-
body=fleetspace_body
3366+
body=fleetspace_resource
33523367
)
33533368

33543369

src/cosmosdb-preview/azext_cosmosdb_preview/tests/latest/recordings/test_cosmosdb_burst_capacity.yaml

Lines changed: 251 additions & 443 deletions
Large diffs are not rendered by default.

src/cosmosdb-preview/azext_cosmosdb_preview/tests/latest/recordings/test_cosmosdb_capacity_mode_account_create.yaml

Lines changed: 447 additions & 687 deletions
Large diffs are not rendered by default.

src/cosmosdb-preview/azext_cosmosdb_preview/tests/latest/recordings/test_cosmosdb_capacity_mode_change.yaml

Lines changed: 290 additions & 482 deletions
Large diffs are not rendered by default.

src/cosmosdb-preview/azext_cosmosdb_preview/tests/latest/recordings/test_cosmosdb_copy_cassandra.yaml

Lines changed: 112 additions & 112 deletions
Large diffs are not rendered by default.

src/cosmosdb-preview/azext_cosmosdb_preview/tests/latest/recordings/test_cosmosdb_copy_mongo.yaml

Lines changed: 113 additions & 113 deletions
Large diffs are not rendered by default.

src/cosmosdb-preview/azext_cosmosdb_preview/tests/latest/recordings/test_cosmosdb_copy_mongo_vcore.yaml

Lines changed: 63 additions & 63 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)