|
28 | 28 | validate_mongo_role_definition_body, |
29 | 29 | validate_mongo_role_definition_id, |
30 | 30 | validate_mongo_user_definition_body, |
31 | | - validate_mongo_user_definition_id) |
| 31 | + validate_mongo_user_definition_id, |
| 32 | + validate_fleetspace_body, |
| 33 | + validate_fleetspaceAccount_body) |
32 | 34 |
|
33 | 35 | from azure.cli.command_modules.cosmosdb.actions import ( |
34 | 36 | CreateLocation, CreateDatabaseRestoreResource, CreateGremlinDatabaseRestoreResource, CreateTableRestoreResource, UtcDatetimeAction, InvokeCommandArgumentsAddAction) |
35 | 37 | from azure.cli.command_modules.cosmosdb.custom import ( |
36 | 38 | CosmosKeyTypes) |
37 | 39 | from azure.mgmt.cosmosdb.models import ( |
38 | | - ContinuousTier, MinimalTlsVersion) |
| 40 | + ContinuousTier, MinimalTlsVersion, DefaultPriorityLevel) |
39 | 41 |
|
40 | 42 | GREMLIN_INDEXING_POLICY_EXAMPLE = """--idx "{\\"indexingMode\\": \\"consistent\\", \\"automatic\\": true, \\"includedPaths\\": [{\\"path\\": \\"/*\\"}], \\"excludedPaths\\": [{ \\"path\\": \\"/headquarters/employees/?\\"}, { \\"path\\": \\"/\\\\"_etag\\\\"/?\\"}]}" |
41 | 43 | """ |
|
72 | 74 | MONGO_USER_DEFINITION_EXAMPLE = """--body "{\\"Id\\": \\"be79875a-2cc4-40d5-8958-566017875b39\\",\\"UserName\\": \\"MyUserName\\",\\"Password\\": \\"MyPass\\",\\"CustomData\\": \\"MyCustomData\\",\\"Mechanisms\\": \\"SCRAM-SHA-256\\"\\"DatabaseName\\": \\"MyDb\\",\\"Roles\\": [ {\\"Role\\": \\"myReadRole\\",\\"Db\\": \\"MyDb\\"}]}" |
73 | 75 | """ |
74 | 76 |
|
| 77 | +FLEETSPACE_PROPERTIES_EXAMPLE = """--body "{ |
| 78 | + \\"properties\\": { |
| 79 | + \\"serviceTier\\": \\"GeneralPurpose\\", |
| 80 | + \\"dataRegions\\": [\\"West US 2\\"], |
| 81 | + \\"throughputPoolConfiguration\\": { |
| 82 | + \\"minThroughput\\": 100000, |
| 83 | + \\"maxThroughput\\": 300000 |
| 84 | + } |
| 85 | + } |
| 86 | +}" |
| 87 | +""" |
| 88 | + |
| 89 | +FLEETSPACE_ACCOUNT_PROPERTIES_EXAMPLE = """--body "{ |
| 90 | + \\"properties\\": { |
| 91 | + \\"globalDatabaseAccountProperties\\": { |
| 92 | + \\"resourceId\\": \\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.DocumentDB/databaseAccounts/example-account\\", |
| 93 | + \\"armLocation\\": \\"East US\\" |
| 94 | + } |
| 95 | + } |
| 96 | +}" |
| 97 | +""" |
| 98 | + |
75 | 99 |
|
76 | 100 | class ThroughputTypes(str, Enum): |
77 | 101 | autoscale = "autoscale" |
@@ -131,6 +155,8 @@ def load_arguments(self, _): |
131 | 155 | c.argument('enable_partition_merge', arg_type=get_three_state_flag(), help="Flag to enable partition merge on the account.") |
132 | 156 | c.argument('enable_burst_capacity', arg_type=get_three_state_flag(), help="Flag to enable burst capacity on the account.") |
133 | 157 | c.argument('enable_prpp_autoscale', arg_type=get_three_state_flag(), help="Enable or disable PerRegionPerPartitionAutoscale.") |
| 158 | + c.argument('enable_pbe', arg_type=get_three_state_flag(), help="Flag to enable priority based execution on the account.") |
| 159 | + c.argument('default_priority_level', arg_type=get_enum_type(DefaultPriorityLevel), help="Default Priority Level of Request if not specified.") |
134 | 160 | c.argument('continuous_tier', arg_type=get_enum_type(ContinuousTier), help="The tier of Continuous backup", arg_group='Backup Policy') |
135 | 161 | c.argument('minimal_tls_version', arg_type=get_enum_type(MinimalTlsVersion), help="Indicates the minimum allowed TLS version") |
136 | 162 |
|
@@ -407,14 +433,15 @@ def load_arguments(self, _): |
407 | 433 | c.argument('target_database_account_name', options_list=['--target-database-account-name', '-n'], help='Name of the new target Cosmos DB database account after the restore') |
408 | 434 | c.argument('account_name', completer=None, options_list=['--account-name', '-a'], help='Name of the source Cosmos DB database account for the restore', id_part=None) |
409 | 435 | c.argument('restore_timestamp', options_list=['--restore-timestamp', '-t'], action=UtcDatetimeAction, help="The timestamp to which the account has to be restored to.") |
410 | | - c.argument('location', arg_type=get_location_type(self.cli_ctx), help="The location of the source account from which restore is triggered. This will also be the write region of the restored account") |
| 436 | + c.argument('location', arg_type=get_location_type(self.cli_ctx), help="This is the write region of the restored account. This is also the location of the source account where its backups are located if source_backup_location is not provided.") |
411 | 437 | c.argument('databases_to_restore', nargs='+', action=CreateDatabaseRestoreResource) |
412 | 438 | c.argument('gremlin_databases_to_restore', nargs='+', action=CreateGremlinDatabaseRestoreResource) |
413 | 439 | c.argument('tables_to_restore', nargs='+', action=CreateTableRestoreResource) |
414 | 440 | c.argument('assign_identity', nargs='*', help="Assign system or user assigned identities separated by spaces. Use '[system]' to refer system assigned identity.") |
415 | 441 | c.argument('default_identity', help="The primary identity to access key vault in CMK related features. e.g. 'FirstPartyIdentity', 'SystemAssignedIdentity' and more.") |
416 | 442 | c.argument('public_network_access', options_list=['--public-network-access', '-p'], arg_type=get_enum_type(['ENABLED', 'DISABLED']), help="Sets public network access in server to either Enabled or Disabled.") |
417 | 443 | c.argument('disable_ttl', options_list=['--disable-ttl', '-d'], arg_type=get_three_state_flag(), help="Enable or disable restoring with ttl disabled.") |
| 444 | + c.argument('source_backup_location', help="This is the location of the source account where backups are located. Provide this value if the source and target are in different locations.", is_preview=True) |
418 | 445 |
|
419 | 446 | # Mongo role definition |
420 | 447 | with self.argument_context('cosmosdb mongodb role definition') as c: |
@@ -681,3 +708,34 @@ def load_arguments(self, _): |
681 | 708 | c.argument('instance_count', options_list=['--count', '-c'], help="Instance Count.") |
682 | 709 | c.argument('instance_size', options_list=['--size'], help="Instance Size. Possible values are: Cosmos.D4s, Cosmos.D8s, Cosmos.D16s etc") |
683 | 710 | c.argument('dedicated_gateway_type', options_list=['--gateway-type'], arg_type=get_enum_type(['IntegratedCache', 'DistributedQuery']), help="Dedicated Gateway Type. Valid only for SqlDedicatedGateway service kind") |
| 711 | + |
| 712 | + # Cosmos DB Fleet |
| 713 | + with self.argument_context('cosmosdb fleet') as c: |
| 714 | + c.argument('resource_group', options_list=['--resource-group', '-g'], help='Name of the resource group.', required=True) |
| 715 | + c.argument('fleet_name', options_list=['--fleet-name', '-n'], help='Name of the Fleet resource.', required=True) |
| 716 | + |
| 717 | + with self.argument_context('cosmosdb fleet create') as c: |
| 718 | + c.argument('location', options_list=['--location', '-l'], help='Location of the Fleet.', required=True) |
| 719 | + c.argument('tags', help="Tags in 'key=value key2=value2' format.") |
| 720 | + |
| 721 | + # Cosmos DB Fleetspace |
| 722 | + with self.argument_context('cosmosdb fleetspace') as c: |
| 723 | + c.argument('resource_group', options_list=['--resource-group', '-g'], help='Name of the resource group.', required=True) |
| 724 | + c.argument('fleet_name', options_list=['--fleet-name'], help='Name of the Cosmos DB Fleet.', required=True) |
| 725 | + c.argument('fleetspace_name', options_list=['--fleetspace-name', '-n'], help='Name of the Fleetspace resource.', required=True) |
| 726 | + |
| 727 | + with self.argument_context('cosmosdb fleetspace create') as c: |
| 728 | + c.argument('fleetspace_body', options_list=['--body', '-b'], validator=validate_fleetspace_body, completer=FilesCompleter(), help="Fleetspace body with properties.serviceTier (required), properties.dataRegions (required), and properties.throughputPoolConfiguration (fields: minThroughput, maxThroughput). You can enter it as a string or as a file, e.g., --body @fleetspace.json or " + FLEETSPACE_PROPERTIES_EXAMPLE) |
| 729 | + |
| 730 | + with self.argument_context('cosmosdb fleetspace update') as c: |
| 731 | + c.argument('fleetspace_body', options_list=['--body', '-b'], validator=validate_fleetspace_body, completer=FilesCompleter(), help="Fleetspace body with properties.serviceTier (optional), properties.dataRegions (optional), and properties.throughputPoolConfiguration (fields: minThroughput, maxThroughput). You can enter it as a string or as a file, e.g., --body @fleetspace.json or " + FLEETSPACE_PROPERTIES_EXAMPLE) |
| 732 | + |
| 733 | + # Cosmos DB Fleetspace account |
| 734 | + with self.argument_context('cosmosdb fleetspace account') as c: |
| 735 | + c.argument('resource_group', options_list=['--resource-group', '-g'], help='Name of the resource group.', required=True) |
| 736 | + c.argument('fleet_name', options_list=['--fleet-name'], help='Name of the Cosmos DB Fleet.', required=True) |
| 737 | + c.argument('fleetspace_name', options_list=['--fleetspace-name'], help='Name of the Fleetspace resource.', required=True) |
| 738 | + c.argument('fleetspace_account_name', options_list=['--fleetspace-account-name', '-n'], help='Name of the Fleetspace Account resource.', required=True) |
| 739 | + |
| 740 | + with self.argument_context('cosmosdb fleetspace account create') as c: |
| 741 | + c.argument('fleetspace_account_body', options_list=['--body', '-b'], validator=validate_fleetspaceAccount_body, completer=FilesCompleter(), help="Fleetspace Account body with properties.globalDatabaseAccountProperties (fields: armLocation, resourceId). You can enter it as a string or as a file, e.g., --body @fleetspaceAccount.json or " + FLEETSPACE_ACCOUNT_PROPERTIES_EXAMPLE) |
0 commit comments