Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CosmosDB] API Version 2024-12-01-preview #8323

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Added throughput type to sql container throughput migrate
  • Loading branch information
Achint-Agrawal authored and pjohari-ms committed Dec 3, 2024
commit e0043b12f9b33c8b19c08ba8a659275ad075ef1d
10 changes: 10 additions & 0 deletions src/cosmosdb-preview/azext_cosmosdb_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long, too-many-statements

from enum import Enum
import argparse
from argcomplete.completers import FilesCompleter

Expand Down Expand Up @@ -104,6 +105,10 @@
}"
"""

class ThroughputTypes(str, Enum):
autoscale = "autoscale"
manual = "manual"


def load_arguments(self, _):
from knack.arguments import CLIArgumentType
Expand Down Expand Up @@ -499,6 +504,7 @@ def load_arguments(self, _):
c.argument('job_name', options_list=['--job-name', '-n'], help='Name of the container copy job.', required=True)

max_throughput_type = CLIArgumentType(options_list=['--max-throughput'], help='The maximum throughput resource can scale to (RU/s). Provided when the resource is autoscale enabled. The minimum value can be 4000 (RU/s)')
throughput_type = CLIArgumentType(options_list=['--throughput-type', '-t'], arg_type=get_enum_type(ThroughputTypes), help='The type of throughput to migrate to.')


# SQL container
Expand Down Expand Up @@ -566,6 +572,10 @@ def load_arguments(self, _):
c.argument('throughput', type=int, help='The throughput of SQL container (RU/s).')
c.argument('max_throughput', max_throughput_type)

for scope in ['sql container throughput migrate']:
with self.argument_context('cosmosdb {}'.format(scope)) as c:
c.argument('throughput_type', throughput_type)

# Mongodb collection partition retrieve throughput
with self.argument_context('cosmosdb mongodb collection retrieve-partition-throughput') as c:
c.argument('account_name', account_name_type, id_part=None, required=True, help='Name of the CosmosDB database account')
Expand Down