diff --git a/src/codespaces/HISTORY.rst b/src/codespaces/HISTORY.rst index 8c34bccfff8..6b34fd2ed1b 100644 --- a/src/codespaces/HISTORY.rst +++ b/src/codespaces/HISTORY.rst @@ -3,6 +3,16 @@ Release History =============== +0.2.0 +++++++ +* Update to latest resource provider API version, 2020-05-26. +* Plan creation: Set plan defaults (default sku, default suspend timeout). +* Plan creation: `--subnet` argument to create a plan with a vnet. +* Codespace creation: Plan defaults will be used for --instance-type and --suspend-after if available and you haven't specified to override the defaults. +* New `az codespace update` command (support for editing sku/suspend timeout of a Suspended codespace). +* `az codespace list` new behavior: By default, we now only show your codespaces. Add `--all` flag to `az codespace list` command to list codespaces of all users. +* Support Secrets Management. + 0.1.0 ++++++ -* Initial release. \ No newline at end of file +* Initial release. diff --git a/src/codespaces/README.rst b/src/codespaces/README.rst index 2fe9e9abaed..2e81c8ed2a5 100644 --- a/src/codespaces/README.rst +++ b/src/codespaces/README.rst @@ -4,3 +4,31 @@ Microsoft Azure CLI 'codespaces' Extension Visual Studio Codespaces - Cloud-powered development environments accessible from anywhere. https://azure.microsoft.com/en-us/services/visual-studio-online/ + +Updating the vendored SDK +------------------------- + +``` +cd /specification/vsonline/resource-manager +autorest --python readme.md +``` + +Custom changes made to auto-generated SDK: +1. Remove trailing `/` from `list_by_resource_group` and `list_by_subscription` plan operations as server will reject request otherwise. +2. Add support for custom API version to be set. + +Before submitting a PR +---------------------- + +``` +azdev style codespaces +azdev linter codespaces +azdev test codespaces +``` + +Test extension on fresh set up: +``` +azdev extension build codespaces +docker run -v .../azure-cli-extensions/dist:/ext -it microsoft/azure-cli +az extension add --source /ext/codespaces-VERSION-py2.py3-none-any.whl +``` diff --git a/src/codespaces/azext_codespaces/__init__.py b/src/codespaces/azext_codespaces/__init__.py index 4dc39f05b5d..caa2031ef87 100644 --- a/src/codespaces/azext_codespaces/__init__.py +++ b/src/codespaces/azext_codespaces/__init__.py @@ -3,28 +3,49 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +from knack.events import EVENT_INVOKER_POST_PARSE_ARGS +from knack.log import get_logger from azure.cli.core import AzCommandsLoader -from azext_codespaces._help import helps # pylint: disable=unused-import +from ._help import helps # pylint: disable=unused-import +from ._config import get_rp_api_version, get_service_domain, DEFAULT_SERVICE_DOMAIN + +logger = get_logger(__name__) + + +def log_custom_config_message(cli_ctx): + custom_rp_api_version = get_rp_api_version(cli_ctx) + if custom_rp_api_version: + logger.warning("Codespaces: Using custom resource provider api version %s", custom_rp_api_version) + custom_service_domain = get_service_domain(cli_ctx) + if custom_service_domain != DEFAULT_SERVICE_DOMAIN: + logger.warning("Codespaces: Using custom service domain %s", custom_service_domain) + + +def event_handler(cli_ctx, **kwargs): + cmd = kwargs.get('command', None) + if cmd and cmd.startswith('codespace'): + log_custom_config_message(cli_ctx) class CodespacesCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): from azure.cli.core.commands import CliCommandType - from azext_codespaces._client_factory import cf_codespaces + from ._client_factory import cf_codespaces codespaces_custom = CliCommandType( operations_tmpl='azext_codespaces.custom#{}', client_factory=cf_codespaces) + cli_ctx.register_event(EVENT_INVOKER_POST_PARSE_ARGS, event_handler) super(CodespacesCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=codespaces_custom) def load_command_table(self, args): - from azext_codespaces.commands import load_command_table + from .commands import load_command_table load_command_table(self, args) return self.command_table def load_arguments(self, command): - from azext_codespaces._params import load_arguments + from ._params import load_arguments load_arguments(self, command) diff --git a/src/codespaces/azext_codespaces/_client_factory.py b/src/codespaces/azext_codespaces/_client_factory.py index 4e57b3cf361..e6fc64259f8 100644 --- a/src/codespaces/azext_codespaces/_client_factory.py +++ b/src/codespaces/azext_codespaces/_client_factory.py @@ -3,11 +3,14 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +from ._config import get_rp_api_version + def cf_codespaces(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client from .vendored_sdks.vsonline.vs_online_client import VSOnlineClient - return get_mgmt_service_client(cli_ctx, VSOnlineClient) + custom_api_version = get_rp_api_version(cli_ctx) + return get_mgmt_service_client(cli_ctx, VSOnlineClient, api_version=custom_api_version) def cf_codespaces_plan(cli_ctx, *_): diff --git a/src/codespaces/azext_codespaces/_config.py b/src/codespaces/azext_codespaces/_config.py new file mode 100644 index 00000000000..e2c55cd3801 --- /dev/null +++ b/src/codespaces/azext_codespaces/_config.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +DEFAULT_SERVICE_DOMAIN = "online.visualstudio.com" + +CONFIG_SECTION = 'codespaces' +KEY_RESOURCE_PROVIDER_API_VERSION = 'resource_provider_api_version' +KEY_SERVICE_DOMAIN = 'service_domain' + + +def get_rp_api_version(cli_ctx): + return cli_ctx.config.get(CONFIG_SECTION, KEY_RESOURCE_PROVIDER_API_VERSION, fallback=None) + + +def get_service_domain(cli_ctx): + return cli_ctx.config.get(CONFIG_SECTION, KEY_SERVICE_DOMAIN, fallback=None) or DEFAULT_SERVICE_DOMAIN + + +def get_current_config(cli_ctx): + return cli_ctx.config.items(CONFIG_SECTION) + + +def set_rp_api_version(cli_ctx, val): + cli_ctx.config.set_value(CONFIG_SECTION, KEY_RESOURCE_PROVIDER_API_VERSION, val) + + +def set_service_domain(cli_ctx, val): + cli_ctx.config.set_value(CONFIG_SECTION, KEY_SERVICE_DOMAIN, val) diff --git a/src/codespaces/azext_codespaces/_help.py b/src/codespaces/azext_codespaces/_help.py index e9afef39d44..889e71dcc64 100644 --- a/src/codespaces/azext_codespaces/_help.py +++ b/src/codespaces/azext_codespaces/_help.py @@ -17,6 +17,16 @@ short-summary: Information on available regions. """ +helps['codespace plan'] = """ + type: group + short-summary: Manage Codespace plans. +""" + +helps['codespace secret'] = """ + type: group + short-summary: Manage plan secrets. +""" + helps['codespace location list'] = """ type: command short-summary: List available regions. @@ -24,12 +34,7 @@ helps['codespace location show'] = """ type: command - short-summary: Show details on a region. -""" - -helps['codespace plan'] = """ - type: group - short-summary: Manage Codespace plans. + short-summary: Show details of a region. """ helps['codespace plan create'] = """ @@ -41,7 +46,13 @@ - name: Create a plan in a specific region text: az codespace plan create -g my-rg -n my-plan -l westus2 - name: Create a plan with tags - text: az codespace plan create -g my-rg -n my-plan -l westus2 --tags tagname=tagvalue + text: az codespace plan create -g my-rg -n my-plan --tags tagname=tagvalue + - name: Create a plan with a default instance type + text: az codespace plan create -g my-rg -n my-plan --default-instance-type premiumLinux + - name: Create a plan with a default suspend after + text: az codespace plan create -g my-rg -n my-plan --default-suspend-after 120 + - name: Create a plan associated with a subnet + text: az codespace plan create -g my-rg -n my-plan --subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/default """ helps['codespace plan list'] = """ @@ -79,7 +90,7 @@ populator-commands: - az codespace location show examples: - - name: Create a Codespace with default settings + - name: Create a Codespace with default plan settings text: az codespace create -g my-rg --plan my-plan --name my-codespace - name: Create a Codespace with a different instance type with custom suspend time text: az codespace create -g my-rg --plan my-plan --name my-codespace --instance-type premiumLinux --suspend-after 5 @@ -95,7 +106,7 @@ examples: - name: List Codespaces text: az codespace list -g my-rg --plan my-plan - - name: List Codespaces given plan id and Codespace name + - name: List Codespaces given plan id text: az codespace list --plan /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.VSOnline/plans/my-plan """ @@ -109,7 +120,16 @@ text: az codespace delete -g my-rg --plan my-plan --id 00000000-0000-0000-0000-000000000000 - name: Delete a Codespace given plan id and Codespace name text: az codespace delete --plan /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.VSOnline/plans/my-plan --name my-codespace +""" +helps['codespace update'] = """ + type: command + short-summary: Update a Codespace. + examples: + - name: Update a Codespace with a different instance type + text: az codespace update -g my-rg --plan my-plan --name my-codespace --instance-type premiumLinux + - name: Update a Codespace with a different suspend after + text: az codespace update -g my-rg --plan my-plan --name my-codespace --suspend-after 30 """ helps['codespace show'] = """ @@ -160,5 +180,52 @@ text: az codespace open -g my-rg --plan my-plan --id 00000000-0000-0000-0000-000000000000 - name: Open a Codespace given plan id and Codespace name text: az codespace open --plan /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.VSOnline/plans/my-plan --name my-codespace +""" +helps['codespace secret create'] = """ + type: command + short-summary: Create a plan secret. + examples: + - name: Create a plan secret. + text: az codespace secret create -g my-rg --plan my-plan --name API_KEY --value "secretkey" --note "service api key" + - name: Create a plan secret with filters. + text: az codespace secret create -g my-rg --plan my-plan --name API_KEY --value "secretkey" --filters GitRepo=https://github.com/repo/name CodespaceName=mycodespace +""" + +helps['codespace secret update'] = """ + type: command + short-summary: Update a plan secret. + examples: + - name: Update a plan secret with new values. + text: az codespace secret update -g my-rg --plan my-plan --id 00000000-0000-0000-0000-000000000000 --name API_KEY --value "newsecretkey" --note "service api key" + - name: Update a plan secret with new filters. + text: az codespace secret update -g my-rg --plan my-plan --id 00000000-0000-0000-0000-000000000000 --filters GitRepo=https://github.com/repo/name CodespaceName=mycodespace + - name: Update a plan secret and clear existing filters. + text: az codespace secret update -g my-rg --plan my-plan --id 00000000-0000-0000-0000-000000000000 --filters '' +""" + +helps['codespace secret delete'] = """ + type: command + short-summary: Delete a plan secret. + examples: + - name: Delete a plan secret. + text: az codespace secret delete -g my-rg --plan my-plan --id 00000000-0000-0000-0000-000000000000 +""" + +helps['codespace secret list'] = """ + type: command + short-summary: List plan secrets. + examples: + - name: List plan secrets. + text: az codespace secret list -g my-rg --plan my-plan +""" + +helps['codespace set-config'] = """ + type: command + short-summary: Set configuration for codespace commands. +""" + +helps['codespace show-config'] = """ + type: command + short-summary: Show current configuration for codespace commands. """ diff --git a/src/codespaces/azext_codespaces/_non_arm_apis.py b/src/codespaces/azext_codespaces/_non_arm_apis.py index cf8d7220108..c762492c0e5 100644 --- a/src/codespaces/azext_codespaces/_non_arm_apis.py +++ b/src/codespaces/azext_codespaces/_non_arm_apis.py @@ -8,16 +8,30 @@ """ import platform +from enum import Enum + import requests + from knack.util import CLIError from knack.log import get_logger from azure.cli.core import __version__ as az_version - from .version import VERSION +from ._config import get_service_domain logger = get_logger(__name__) -API_ROOT = "https://online.visualstudio.com/api/v1" +API_ROUTE = "/api/v1" + + +# The current secret scopes available on the service +class SecretScope(Enum): + PLAN = 1 + USER = 2 + + +# The current secret types available on the service +class SecretType(Enum): + ENVIRONMENT_VARIABLE = 1 def _get_user_agent_string(): @@ -29,13 +43,19 @@ def _get_user_agent_string(): return f"python/{pv} ({ps}-{pr}-{pm}-{pp}) azure-cli/{az_version} codespaces-extension/{VERSION}" -def assert_status_hook(r, *args, **kwargs): # pylint: disable=unused-argument +def assert_status_hook(r, *_, **__): r.raise_for_status() -def response_logging_hook(response, *args, **kwargs): # pylint: disable=unused-argument - logger.debug('Request: %s', response.request.__dict__) - logger.debug('Response: %s', response.__dict__) +def response_logging_hook(response, *_, **__): + for k in response.request.__dict__: + if k and not k.startswith('_'): + logger.debug('codespaces-api.request : %s : %s', k, response.request.__dict__[k]) + for k in response.__dict__: + if k and not k.startswith('_'): + logger.debug('codespaces-api.response : %s : %s', k, response.__dict__[k]) + if response.content: + logger.debug('codespaces-api.response : %s : %s', 'content', response.content) class NoStripAuthSession(requests.Session): @@ -64,68 +84,135 @@ def wrapper(*args, **kwargs): return response.json() if response.content else response return None except requests.HTTPError as err: - raise CLIError(str(err)) + raise CLIError(f"{err}. Use --debug for details.") + return wrapper + + +def custom_api_root_decorator(func): + def wrapper(*args, **kwargs): + cli_ctx = kwargs.pop('cli_ctx') + domain = get_service_domain(cli_ctx) + api_root = f"https://{domain}{API_ROUTE}" + kwargs['api_root'] = api_root + return func(*args, **kwargs) return wrapper +@custom_api_root_decorator @api_response_decorator -def list_locations(): - url = f'{API_ROOT}/locations' +def list_locations(api_root=None, **_): + url = f'{api_root}/locations' response = session.get(url) return response +@custom_api_root_decorator @api_response_decorator -def get_location_details(location): - url = f'{API_ROOT}/locations/{location}' +def get_location_details(location, api_root=None, **_): + url = f'{api_root}/locations/{location}' response = session.get(url) return response +@custom_api_root_decorator @api_response_decorator -def list_codespaces(access_token, plan_id): - url = f'{API_ROOT}/environments' +def list_codespaces(access_token, plan_id, api_root=None, **_): + url = f'{api_root}/environments' headers = {'Authorization': f'Bearer {access_token}'} params = {'planId': plan_id} response = session.get(url, headers=headers, params=params) return response +@custom_api_root_decorator @api_response_decorator -def get_codespace(access_token, codespace_id): - url = f'{API_ROOT}/environments/{codespace_id}' +def get_codespace(access_token, codespace_id, api_root=None, **_): + url = f'{api_root}/environments/{codespace_id}' headers = {'Authorization': f'Bearer {access_token}'} response = session.get(url, headers=headers) return response +@custom_api_root_decorator @api_response_decorator -def start_codespace(access_token, codespace_id): - url = f'{API_ROOT}/environments/{codespace_id}/start' +def start_codespace(access_token, codespace_id, api_root=None, **_): + url = f'{api_root}/environments/{codespace_id}/start' headers = {'Authorization': f'Bearer {access_token}'} response = session.post(url, headers=headers) return response +@custom_api_root_decorator @api_response_decorator -def shutdown_codespace(access_token, codespace_id): - url = f'{API_ROOT}/environments/{codespace_id}/shutdown' +def shutdown_codespace(access_token, codespace_id, api_root=None, **_): + url = f'{api_root}/environments/{codespace_id}/shutdown' headers = {'Authorization': f'Bearer {access_token}'} response = session.post(url, headers=headers) return response +@custom_api_root_decorator @api_response_decorator -def delete_codespace(access_token, codespace_id): - url = f'{API_ROOT}/environments/{codespace_id}' +def delete_codespace(access_token, codespace_id, api_root=None, **_): + url = f'{api_root}/environments/{codespace_id}' headers = {'Authorization': f'Bearer {access_token}'} response = session.delete(url, headers=headers) return response +@custom_api_root_decorator @api_response_decorator -def create_codespace(access_token, data): - url = f'{API_ROOT}/environments' +def create_codespace(access_token, data, api_root=None, **_): + url = f'{api_root}/environments' headers = {'Authorization': f'Bearer {access_token}'} response = session.post(url, headers=headers, json=data) return response + + +@custom_api_root_decorator +@api_response_decorator +def update_codespace(access_token, codespace_id, data, api_root=None, **_): + url = f'{api_root}/environments/{codespace_id}' + headers = {'Authorization': f'Bearer {access_token}'} + response = session.patch(url, headers=headers, json=data) + return response + + +@custom_api_root_decorator +@api_response_decorator +def list_secrets(access_token, plan_id, api_root=None, **_): + url = f'{api_root}/secrets' + headers = {'Authorization': f'Bearer {access_token}'} + params = {'planId': plan_id} + response = session.get(url, headers=headers, params=params) + return response + + +@custom_api_root_decorator +@api_response_decorator +def create_secret(access_token, plan_id, data, api_root=None, **_): + url = f'{api_root}/secrets' + headers = {'Authorization': f'Bearer {access_token}'} + params = {'planId': plan_id} + response = session.post(url, headers=headers, json=data, params=params) + return response + + +@custom_api_root_decorator +@api_response_decorator +def update_secret(access_token, plan_id, secret_id, data, api_root=None, **_): + url = f'{api_root}/secrets/{secret_id}' + headers = {'Authorization': f'Bearer {access_token}'} + params = {'planId': plan_id} + response = session.put(url, headers=headers, json=data, params=params) + return response + + +@custom_api_root_decorator +@api_response_decorator +def delete_secret(access_token, plan_id, secret_id, scope, api_root=None, **_): + url = f'{api_root}/secrets/{secret_id}' + headers = {'Authorization': f'Bearer {access_token}'} + params = {'planId': plan_id, 'scope': scope} + response = session.delete(url, headers=headers, params=params) + return response diff --git a/src/codespaces/azext_codespaces/_params.py b/src/codespaces/azext_codespaces/_params.py index 852fe1ac2a4..2f8c9ee6922 100644 --- a/src/codespaces/azext_codespaces/_params.py +++ b/src/codespaces/azext_codespaces/_params.py @@ -2,31 +2,40 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- + # pylint: disable=line-too-long -from azure.cli.core.commands.parameters import ( - get_location_type -) -from ._validators import validate_codespace_name_or_id, validate_plan_name_or_id def load_arguments(self, _): - from azure.cli.core.commands.parameters import tags_type, get_enum_type + import platform + from azure.cli.core.commands.parameters import tags_type, get_enum_type, get_location_type from azure.cli.core.commands.validators import get_default_location_from_resource_group + from ._validators import validate_codespace_name_or_id, validate_plan_name_or_id, validate_secret_filter_list with self.argument_context('codespace') as c: c.argument('tags', tags_type) c.argument('location', get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) - c.argument('plan_name', options_list=['--plan', '-p'], help="Name or ID of the Codespace plan", validator=validate_plan_name_or_id) + c.argument('plan_name', options_list=['--plan', '-p'], help="Name or ID of the Codespace plan", + validator=validate_plan_name_or_id) c.argument('codespace_name', options_list=['--name', '-n'], help='Name of the Codespace.') - c.argument('codespace_id', options_list=['--id'], help='Id of the Codespace.', validator=validate_codespace_name_or_id) + c.argument('codespace_id', options_list=['--id'], help='Id of the Codespace.', + validator=validate_codespace_name_or_id) + c.argument('sku_name', options_list=['--instance-type'], help='Instance Type') + c.argument('autoshutdown_delay', options_list=['--suspend-after'], + arg_type=get_enum_type(['5', '30', '120']), + help="Automatically suspend the inactive Codespace after this many minutes.") with self.argument_context('codespace plan') as c: c.argument('plan_name', options_list=['--name', '-n'], help="Name of the Codespace plan", id_part='name') + c.argument('subnet_id', arg_group="Network", options_list=['--subnet'], + help="Resource ID of an existing subnet. If specified, all Codespaces in this plan will be created in this subnet. The subnet must be in the same region as the plan.") + c.argument('default_autoshutdown_delay', arg_group="Plan Default", options_list=['--default-suspend-after'], + arg_type=get_enum_type(['5', '30', '120']), + help="Default minutes Codespaces in this plan should suspend after.") + c.argument('default_sku_name', arg_group="Plan Default", options_list=['--default-instance-type'], help="Default Instance Type for Codespaces in this plan.") with self.argument_context('codespace create') as c: c.argument('friendly_name', options_list=['--name', '-n'], help='Name of the Codespace.') - c.argument('sku_name', options_list=['--instance-type']) - c.argument('autoshutdown_delay', options_list=['--suspend-after'], arg_type=get_enum_type(['5', '30', '120']), help="Automatically suspend the inactive Codespace after this many minutes.") c.argument('git_repo', arg_group="Git", help="Url of the git repository we'll clone into the Codespace") c.argument('git_user_name', arg_group="Git", help="Git username. For example, the output of `git config user.name`") c.argument('git_user_email', arg_group="Git", help="Git user email. For example, the output of `git config user.email`") @@ -34,8 +43,32 @@ def load_arguments(self, _): c.argument('dotfiles_path', arg_group="Dotfiles", help="Path where you expect your dotfiles repository to be cloned into the Codespace.") c.argument('dotfiles_command', arg_group="Dotfiles", help="The command we'll run after cloning your dotfiles repository.") + with self.argument_context('codespace list') as c: + c.argument('list_all', options_list=['--all'], action='store_true', + help="Include the Codespaces of other users. You may not have access to connect or modify these other Codespaces.") + with self.argument_context('codespace open') as c: - c.argument('do_not_prompt', options_list=['--yes', '-y'], action='store_true', help='Do not prompt for confirmation.') + c.argument('do_not_prompt', options_list=['--yes', '-y'], action='store_true', + help='Do not prompt for confirmation.') with self.argument_context('codespace location show') as c: c.argument('location_name', options_list=['--name', '-n'], help='Name of the region.') + + # Hidden arguments that should largely be used by the dev team + with self.argument_context('codespace') as c: + c.argument('config_rp_api_version', options_list=['--rp'], help="Resource Provider API version to use.") + c.argument('config_service_domain', options_list=['--domain'], help="Service domain to use.") + c.argument('config_clear', options_list=['--clear'], action='store_true', + help='Clear current configuration to return to defaults.') + + with self.argument_context('codespace secret') as c: + quotes = '""' if platform.system() == 'Windows' else "''" + quote_text = 'Use {} to clear existing filters.'.format(quotes) + c.argument('secret_filters', arg_group="Secret", options_list=['--filters'], + validator=validate_secret_filter_list, + help=f"space-separated filters: type=value [type=value ...]. {quote_text} Allowed types: GitRepo, CodespaceName.", + nargs='*') + c.argument('secret_name', arg_group="Secret", options_list=['--name', '-n'], help="Name of the secret.") + c.argument('secret_value', arg_group="Secret", options_list=['--value'], help="Value of the secret.") + c.argument('secret_note', arg_group="Secret", options_list=['--note'], help="Note for the secret.") + c.argument('secret_id', options_list=['--id'], help="Id of the secret.") diff --git a/src/codespaces/azext_codespaces/_transformers.py b/src/codespaces/azext_codespaces/_transformers.py index 393cd105338..3341850f831 100644 --- a/src/codespaces/azext_codespaces/_transformers.py +++ b/src/codespaces/azext_codespaces/_transformers.py @@ -19,7 +19,7 @@ def transform_codespace_item_output(item): ('created', item['created']), ('updated', item['updated']), ('lastUsed', item['lastUsed']), - ('autoShutdownDelayMinutes', item['autoShutdownDelayMinutes'])]) + ('autoShutdownDelayMinutes', item.get('autoShutdownDelayMinutes', None))]) return new_result @@ -43,3 +43,20 @@ def transform_location_detail_output(result): ('defaultAutoSuspendDelayMinutes', defaultAutoSuspendDelayMinutes)]) new_result.append(new_entry) return new_result + + +def transform_plan_secret_list_output(result): + new_result = [transform_plan_secret_item_output(item) for item in result] + return new_result + + +def transform_plan_secret_item_output(item): + from collections import OrderedDict + new_result = OrderedDict([('secretId', item['id']), + ('secretName', item['secretName']), + ('secretType', item['type']), + ('scope', item['scope']), + ('lastModified', item['lastModified']), + ('filters', ' '.join(f"{v['type']}={v['value']}" for v in item.get('filters', []))), + ('notes', item.get('notes', None))]) + return new_result diff --git a/src/codespaces/azext_codespaces/_validators.py b/src/codespaces/azext_codespaces/_validators.py index 067f0f76caf..0b3ad56dad3 100644 --- a/src/codespaces/azext_codespaces/_validators.py +++ b/src/codespaces/azext_codespaces/_validators.py @@ -20,3 +20,25 @@ def validate_plan_name_or_id(cmd, namespace): namespace.resource_group_name = resource_id_parts['resource_group'] namespace.plan_name = resource_id_parts['resource_name'] cmd.cli_ctx.data['subscription_id'] = resource_id_parts['subscription'] + + +def validate_secret_filter_list(namespace): + """ Extracts multiple space-separated filters in type=value format """ + if isinstance(namespace.secret_filters, list): + filters_list = [] + for item in namespace.secret_filters: + filter_item = validate_secret_filter_item(item) + if filter_item: + filters_list.append(filter_item) + namespace.secret_filters = filters_list + + +def validate_secret_filter_item(item): + """ Extracts a single filter in type=value format """ + result = {} + if item: + comps = item.split('=', 1) + if len(comps) != 2 or not comps[1]: + raise CLIError("usage error: --filters type=value [type=value ...]") + result = {'type': comps[0], 'value': comps[1]} + return result diff --git a/src/codespaces/azext_codespaces/commands.py b/src/codespaces/azext_codespaces/commands.py index 4c97f8c642d..5323e094092 100644 --- a/src/codespaces/azext_codespaces/commands.py +++ b/src/codespaces/azext_codespaces/commands.py @@ -10,7 +10,12 @@ transform_codespace_list_output, transform_codespace_item_output, transform_location_list_output, - transform_location_detail_output) + transform_location_detail_output, + transform_plan_secret_list_output) + + +def advanced_usage_message(_): + return 'This command is for advanced usage only.' def load_command_table(self, _): @@ -22,8 +27,16 @@ def load_command_table(self, _): with self.command_group('codespace plan', plan_operations, client_factory=cf_codespaces_plan) as g: g.custom_command('list', 'list_plans') g.custom_command('create', 'create_plan') + # TODO Re-enable plan update when service-side implemented + # g.custom_command('update', 'update_plan') g.show_command('show', 'get') - g.command('delete', 'delete') + g.command('delete', 'delete', confirmation="Are you sure you want to delete this Codespace plan?") + + with self.command_group('codespace secret', plan_operations, client_factory=cf_codespaces_plan) as g: + g.custom_command('list', 'list_plan_secrets', table_transformer=transform_plan_secret_list_output) + g.custom_command('update', 'update_plan_secrets') + g.custom_command('create', 'create_plan_secret') + g.custom_command('delete', 'delete_plan_secret') with self.command_group('codespace', plan_operations, client_factory=cf_codespaces_plan) as g: g.custom_command('list', 'list_codespaces', table_transformer=transform_codespace_list_output) @@ -33,8 +46,16 @@ def load_command_table(self, _): g.custom_command('delete', 'delete_codespace', confirmation="Are you sure you want to delete this Codespace?") g.custom_command('resume', 'resume_codespace', table_transformer=transform_codespace_item_output) g.custom_command('suspend', 'suspend_codespace', table_transformer=transform_codespace_item_output) + g.custom_command('update', 'update_codespace', table_transformer=transform_codespace_item_output) + + # Hidden commands that should largely be used by the dev team + with self.command_group('codespace') as g: + g.custom_command('set-config', 'set_config', + deprecate_info=self.deprecate(hide=True, message_func=advanced_usage_message)) + g.custom_command('show-config', 'show_config', + deprecate_info=self.deprecate(hide=True, message_func=advanced_usage_message)) - with self.command_group('codespace location', plan_operations, client_factory=cf_codespaces_plan) as g: + with self.command_group('codespace location') as g: g.custom_command('list', 'list_available_locations', table_transformer=transform_location_list_output) g.custom_show_command('show', 'get_location_details', table_transformer=transform_location_detail_output) diff --git a/src/codespaces/azext_codespaces/custom.py b/src/codespaces/azext_codespaces/custom.py index 0173c8713ab..31d4d4d6e18 100644 --- a/src/codespaces/azext_codespaces/custom.py +++ b/src/codespaces/azext_codespaces/custom.py @@ -6,17 +6,22 @@ from knack.util import CLIError from knack.log import get_logger from knack.prompting import prompt_y_n -from azext_codespaces import _non_arm_apis as cf_api -from .vendored_sdks.vsonline.models import VSOnlinePlan, VSOnlinePlanProperties +from . import _non_arm_apis as cs_api +from . import _config as cs_config +from .vendored_sdks.vsonline.models import ( + VSOnlinePlan, + VSOnlinePlanProperties, + VnetProperties, + VSOPlanUpdateParametersProperties) logger = get_logger(__name__) -CODESPACE_IN_BROWSER_PREFIX = "https://online.visualstudio.com/environment" - -def _determine_codespace_id(client, resource_group_name, plan_name, token, codespace_name): +def _determine_codespace_id(client, resource_group_name, plan_name, token, codespace_name, cli_ctx=None): + if not cli_ctx: + raise ValueError("cli_ctx kwarg must be set.") plan = client.get(resource_group_name=resource_group_name, plan_name=plan_name) - codespaces = cf_api.list_codespaces(token.access_token, plan.id) + codespaces = cs_api.list_codespaces(token.access_token, plan.id, cli_ctx=cli_ctx) codespace_id = next((c['id'] for c in codespaces if c['friendlyName'] == codespace_name), None) if codespace_id: return codespace_id @@ -30,7 +35,15 @@ def list_plans(cmd, client, resource_group_name=None): return client.list_by_subscription() -def create_plan(cmd, client, resource_group_name, plan_name, location=None, tags=None): +def create_plan(cmd, + client, + resource_group_name, + plan_name, + location=None, + tags=None, + subnet_id=None, + default_sku_name=None, + default_autoshutdown_delay=None): import jwt # pylint: disable=import-error from azure.cli.core._profile import Profile profile = Profile(cli_ctx=cmd.cli_ctx) @@ -47,34 +60,54 @@ def create_plan(cmd, client, resource_group_name, plan_name, location=None, tags logger.debug("Unable to determine 'tid' and 'oid' from token claims: %s", decoded_token) raise CLIError("Unable to create plan. Use --debug for details.") user_id = f"{tid}_{oid}" - plan_props = VSOnlinePlanProperties(user_id=user_id) + vnet_props = VnetProperties(subnet_id=subnet_id) if subnet_id else None + plan_props = VSOnlinePlanProperties( + user_id=user_id, + default_auto_suspend_delay_minutes=default_autoshutdown_delay, + default_environment_sku=default_sku_name, + vnet_properties=vnet_props) vsonline_plan = VSOnlinePlan(location=location, properties=plan_props, tags=tags) return client.create(resource_group_name, plan_name, vsonline_plan) -def list_available_locations(): - return cf_api.list_locations() +def update_plan(cmd, + client, + plan_name, + resource_group_name=None, + default_sku_name=None, + default_autoshutdown_delay=None): + vsonline_plan_update_parameters = VSOPlanUpdateParametersProperties( + default_auto_suspend_delay_minutes=default_autoshutdown_delay, + default_environment_sku=default_sku_name) + return client.update(resource_group_name, + plan_name, + vsonline_plan_update_parameters) -def get_location_details(location_name): - return cf_api.get_location_details(location_name) +def list_available_locations(cmd): + return cs_api.list_locations(cli_ctx=cmd.cli_ctx) -# pylint: disable=unused-argument -def list_codespaces(cmd, client, plan_name, resource_group_name=None): +def get_location_details(cmd, location_name): + return cs_api.get_location_details(location_name, cli_ctx=cmd.cli_ctx) + + +def list_codespaces(cmd, client, plan_name, resource_group_name=None, list_all=None): plan = client.get(resource_group_name=resource_group_name, plan_name=plan_name) - token = client.read_all_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) - return cf_api.list_codespaces(token.access_token, plan.id) + if list_all: + token = client.read_all_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + else: + token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + return cs_api.list_codespaces(token.access_token, plan.id, cli_ctx=cmd.cli_ctx) -# pylint: disable=unused-argument def create_codespace(cmd, client, plan_name, friendly_name, resource_group_name=None, - sku_name='standardLinux', - autoshutdown_delay=30, + sku_name=None, + autoshutdown_delay=None, git_repo=None, git_user_name=None, git_user_email=None, @@ -83,6 +116,19 @@ def create_codespace(cmd, dotfiles_command=None): plan = client.get(resource_group_name=resource_group_name, plan_name=plan_name) token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + # Use plan defaults if needed and available + missing_args = [] + sku_name = sku_name or plan.properties.default_environment_sku + if not sku_name: + logger.warning("No default instance type specified for plan and no instance type specified in command.") + missing_args.append("--instance-type") + autoshutdown_delay = autoshutdown_delay or plan.properties.default_auto_suspend_delay_minutes + if not autoshutdown_delay: + logger.warning("No default shutdown delay specified for plan and no shutdown delay specified in command.") + missing_args.append("--suspend-after") + if missing_args: + raise CLIError(f"usage error: please specify {' '.join(missing_args)}") + # Construct create parameters create_data = {} create_data['planId'] = plan.id create_data['friendlyName'] = friendly_name @@ -104,56 +150,134 @@ def create_codespace(cmd, create_data["personalization"]["dotfilesTargetPath"] = dotfiles_path if dotfiles_command: create_data["personalization"]["dotfilesInstallCommand"] = dotfiles_command - return cf_api.create_codespace(token.access_token, create_data) + # Create codespace + return cs_api.create_codespace(token.access_token, create_data, cli_ctx=cmd.cli_ctx) -# pylint: disable=unused-argument def get_codespace(cmd, client, plan_name, resource_group_name=None, codespace_id=None, codespace_name=None): - token = client.read_all_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) if codespace_name: - codespace_id = _determine_codespace_id(client, resource_group_name, plan_name, token, codespace_name) - return cf_api.get_codespace(token.access_token, codespace_id) + codespace_id = _determine_codespace_id( + client, resource_group_name, plan_name, token, codespace_name, cli_ctx=cmd.cli_ctx) + return cs_api.get_codespace(token.access_token, codespace_id, cli_ctx=cmd.cli_ctx) -# pylint: disable=unused-argument def delete_codespace(cmd, client, plan_name, resource_group_name=None, codespace_id=None, codespace_name=None): token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) if codespace_name: - codespace_id = _determine_codespace_id(client, resource_group_name, plan_name, token, codespace_name) - cf_api.delete_codespace(token.access_token, codespace_id) + codespace_id = _determine_codespace_id( + client, resource_group_name, plan_name, token, codespace_name, cli_ctx=cmd.cli_ctx) + cs_api.delete_codespace(token.access_token, codespace_id, cli_ctx=cmd.cli_ctx) -# pylint: disable=unused-argument def resume_codespace(cmd, client, plan_name, resource_group_name=None, codespace_id=None, codespace_name=None): token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) if codespace_name: - codespace_id = _determine_codespace_id(client, resource_group_name, plan_name, token, codespace_name) - return cf_api.start_codespace(token.access_token, codespace_id) + codespace_id = _determine_codespace_id( + client, resource_group_name, plan_name, token, codespace_name, cli_ctx=cmd.cli_ctx) + return cs_api.start_codespace(token.access_token, codespace_id, cli_ctx=cmd.cli_ctx) -# pylint: disable=unused-argument def suspend_codespace(cmd, client, plan_name, resource_group_name=None, codespace_id=None, codespace_name=None): token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) if codespace_name: - codespace_id = _determine_codespace_id(client, resource_group_name, plan_name, token, codespace_name) - return cf_api.shutdown_codespace(token.access_token, codespace_id) + codespace_id = _determine_codespace_id( + client, resource_group_name, plan_name, token, codespace_name, cli_ctx=cmd.cli_ctx) + return cs_api.shutdown_codespace(token.access_token, codespace_id, cli_ctx=cmd.cli_ctx) + + +def update_codespace(cmd, + client, + plan_name, + resource_group_name=None, + codespace_id=None, + codespace_name=None, + sku_name=None, + autoshutdown_delay=None): + token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + if codespace_name: + codespace_id = _determine_codespace_id( + client, resource_group_name, plan_name, token, codespace_name, cli_ctx=cmd.cli_ctx) + data = {} + codespace = cs_api.get_codespace(token.access_token, codespace_id, cli_ctx=cmd.cli_ctx) + if codespace['state'] != 'Shutdown': + raise CLIError("Codespace must be in state 'Shutdown'. " + f"Cannot update a Codespace in state '{codespace['state']}'.") + if sku_name: + data['skuName'] = sku_name + if autoshutdown_delay: + data['autoShutdownDelayMinutes'] = autoshutdown_delay + return cs_api.update_codespace(token.access_token, codespace_id, data, cli_ctx=cmd.cli_ctx) -# pylint: disable=unused-argument def open_codespace(cmd, client, plan_name, resource_group_name=None, codespace_id=None, codespace_name=None, do_not_prompt=None): - token = client.read_all_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) if codespace_name: - codespace_id = _determine_codespace_id(client, resource_group_name, plan_name, token, codespace_name) - codespace = cf_api.get_codespace(token.access_token, codespace_id) + codespace_id = _determine_codespace_id( + client, resource_group_name, plan_name, token, codespace_name, cli_ctx=cmd.cli_ctx) + codespace = cs_api.get_codespace(token.access_token, codespace_id, cli_ctx=cmd.cli_ctx) if not do_not_prompt and codespace['state'] != 'Available': msg = f"Current state of the codespace is '{codespace['state']}'." \ - " Continuing will cause the environment to be resumed. Do you want to continue?" + " Continuing will cause the environment to be resumed.\nDo you want to continue?" user_confirmed = prompt_y_n(msg) if not user_confirmed: raise CLIError("Operation cancelled.") - url = f"{CODESPACE_IN_BROWSER_PREFIX}/{codespace['id']}" + domain = cs_config.get_service_domain(cmd.cli_ctx) + url = f"https://{domain}/environment/{codespace['id']}" logger.warning("Opening: %s", url) success = webbrowser.open_new_tab(url) if not success: raise CLIError("Unable to open browser") + + +def set_config(cmd, config_rp_api_version='', config_service_domain='', config_clear=False): + if config_clear and any([config_rp_api_version, config_service_domain]): + raise CLIError("If you wish to clear config, do not specify other values.") + cs_config.set_rp_api_version(cmd.cli_ctx, config_rp_api_version) + cs_config.set_service_domain(cmd.cli_ctx, config_service_domain) + + +def show_config(cmd): + return cs_config.get_current_config(cmd.cli_ctx) + + +def list_plan_secrets(cmd, client, plan_name, resource_group_name=None): + plan = client.get(resource_group_name=resource_group_name, plan_name=plan_name) + token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + return cs_api.list_secrets(token.access_token, plan.id, cli_ctx=cmd.cli_ctx) + + +def update_plan_secrets(cmd, client, plan_name, secret_id, + secret_name=None, secret_value=None, secret_note=None, + secret_filters=None, resource_group_name=None): + plan = client.get(resource_group_name=resource_group_name, plan_name=plan_name) + token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + data = {} + data['secretName'] = secret_name + data['value'] = secret_value + data['notes'] = secret_note + data['scope'] = cs_api.SecretScope.USER.value + data['filters'] = secret_filters + return cs_api.update_secret(token.access_token, plan.id, secret_id, data, cli_ctx=cmd.cli_ctx) + + +def create_plan_secret(cmd, client, plan_name, + secret_name, secret_value, secret_note=None, + secret_filters=None, resource_group_name=None): + plan = client.get(resource_group_name=resource_group_name, plan_name=plan_name) + token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + data = {} + data['secretName'] = secret_name + data['value'] = secret_value + data['notes'] = secret_note + data['type'] = cs_api.SecretType.ENVIRONMENT_VARIABLE.value + data['scope'] = cs_api.SecretScope.USER.value + data['filters'] = secret_filters + return cs_api.create_secret(token.access_token, plan.id, data, cli_ctx=cmd.cli_ctx) + + +def delete_plan_secret(cmd, client, plan_name, secret_id, resource_group_name=None): + plan = client.get(resource_group_name=resource_group_name, plan_name=plan_name) + token = client.write_environments_action(resource_group_name=resource_group_name, plan_name=plan_name) + cs_api.delete_secret(token.access_token, plan.id, secret_id, cs_api.SecretScope.USER.value, cli_ctx=cmd.cli_ctx) diff --git a/src/codespaces/azext_codespaces/tests/latest/recordings/test_codespaces.yaml b/src/codespaces/azext_codespaces/tests/latest/recordings/test_codespaces.yaml index 3cc683124fa..3be21270e70 100644 --- a/src/codespaces/azext_codespaces/tests/latest/recordings/test_codespaces.yaml +++ b/src/codespaces/azext_codespaces/tests/latest/recordings/test_codespaces.yaml @@ -14,11 +14,11 @@ interactions: - -g User-Agent: - python/3.7.4 (Darwin-19.5.0-x86_64-i386-64bit) msrest/0.6.13 msrest_azure/0.6.3 - vsonline/07/01/2019 00:00:00 Azure-SDK-For-Python AZURECLI/2.5.1 + vsonline/05/26/2020 00:00:00 Azure-SDK-For-Python AZURECLI/2.5.1 accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_codespaces000001/providers/Microsoft.VSOnline/plans/?api-version=2019-07-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_codespaces000001/providers/Microsoft.VSOnline/plans?api-version=2020-05-26-preview response: body: string: '{"value":[]}' @@ -30,7 +30,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 01 Jun 2020 22:30:00 GMT + - Tue, 09 Jun 2020 00:09:15 GMT expires: - '-1' pragma: diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/__init__.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/__init__.py index 5607de92d15..2473d5593fe 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/__init__.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/__init__.py @@ -15,11 +15,10 @@ from .error_definition_py3 import ErrorDefinition from .vso_account_error_response_py3 import VSOAccountErrorResponse, VSOAccountErrorResponseException from .resource_py3 import Resource - from .vs_online_account_properties_py3 import VSOnlineAccountProperties - from .vs_online_account_py3 import VSOnlineAccount - from .vs_online_account_info_py3 import VSOnlineAccountInfo + from .vnet_properties_py3 import VnetProperties from .resource_provider_operation_display_py3 import ResourceProviderOperationDisplay from .resource_provider_operation_definition_py3 import ResourceProviderOperationDefinition + from .vso_plan_update_parameters_properties_py3 import VSOPlanUpdateParametersProperties from .vso_plan_update_parameters_py3 import VSOPlanUpdateParameters from .vso_plan_error_response_py3 import VSOPlanErrorResponse, VSOPlanErrorResponseException from .vs_online_plan_properties_py3 import VSOnlinePlanProperties @@ -34,11 +33,10 @@ from .error_definition import ErrorDefinition from .vso_account_error_response import VSOAccountErrorResponse, VSOAccountErrorResponseException from .resource import Resource - from .vs_online_account_properties import VSOnlineAccountProperties - from .vs_online_account import VSOnlineAccount - from .vs_online_account_info import VSOnlineAccountInfo + from .vnet_properties import VnetProperties from .resource_provider_operation_display import ResourceProviderOperationDisplay from .resource_provider_operation_definition import ResourceProviderOperationDefinition + from .vso_plan_update_parameters_properties import VSOPlanUpdateParametersProperties from .vso_plan_update_parameters import VSOPlanUpdateParameters from .vso_plan_error_response import VSOPlanErrorResponse, VSOPlanErrorResponseException from .vs_online_plan_properties import VSOnlinePlanProperties @@ -48,7 +46,6 @@ from .vs_online_delegate_identity import VSOnlineDelegateIdentity from .vs_online_delegate_access_token_request_body import VSOnlineDelegateAccessTokenRequestBody from .resource_provider_operation_definition_paged import ResourceProviderOperationDefinitionPaged -from .vs_online_account_paged import VSOnlineAccountPaged from .vs_online_plan_paged import VSOnlinePlanPaged from .vs_online_client_enums import ( SkuTier, @@ -60,11 +57,10 @@ 'ErrorDefinition', 'VSOAccountErrorResponse', 'VSOAccountErrorResponseException', 'Resource', - 'VSOnlineAccountProperties', - 'VSOnlineAccount', - 'VSOnlineAccountInfo', + 'VnetProperties', 'ResourceProviderOperationDisplay', 'ResourceProviderOperationDefinition', + 'VSOPlanUpdateParametersProperties', 'VSOPlanUpdateParameters', 'VSOPlanErrorResponse', 'VSOPlanErrorResponseException', 'VSOnlinePlanProperties', @@ -74,7 +70,6 @@ 'VSOnlineDelegateIdentity', 'VSOnlineDelegateAccessTokenRequestBody', 'ResourceProviderOperationDefinitionPaged', - 'VSOnlineAccountPaged', 'VSOnlinePlanPaged', 'SkuTier', ] diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vnet_properties.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vnet_properties.py new file mode 100644 index 00000000000..14b133d0e4a --- /dev/null +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vnet_properties.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class VnetProperties(Model): + """Model representing Vnet Injection properties for VS Online Account. + + :param subnet_id: The ARM resource identifier of the virtual network + subnet which the codespaces of the VSO Plan will join. This is of the form + /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}.The + virtual network must be in the same region and subscription as the VSO + Plan. + :type subnet_id: str + """ + + _attribute_map = { + 'subnet_id': {'key': 'SubnetId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VnetProperties, self).__init__(**kwargs) + self.subnet_id = kwargs.get('subnet_id', None) diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vnet_properties_py3.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vnet_properties_py3.py new file mode 100644 index 00000000000..e332114de13 --- /dev/null +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vnet_properties_py3.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class VnetProperties(Model): + """Model representing Vnet Injection properties for VS Online Account. + + :param subnet_id: The ARM resource identifier of the virtual network + subnet which the codespaces of the VSO Plan will join. This is of the form + /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}.The + virtual network must be in the same region and subscription as the VSO + Plan. + :type subnet_id: str + """ + + _attribute_map = { + 'subnet_id': {'key': 'SubnetId', 'type': 'str'}, + } + + def __init__(self, *, subnet_id: str=None, **kwargs) -> None: + super(VnetProperties, self).__init__(**kwargs) + self.subnet_id = subnet_id diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account.py deleted file mode 100644 index 2a4fd9310c3..00000000000 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VSOnlineAccount(Model): - """VS Online Account. Represents the high level account needed to provision VS - Online resources. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param tags: Tags for the VS Online Account - :type tags: dict[str, str] - :param location: Required. Region where the Azure resource is located. - :type location: str - :param sku: SKU of the service. - :type sku: ~microsoft.vsonline.models.Sku - :param properties: VS Online Additional properties. Additional VS Online - Account properties. - :type properties: ~microsoft.vsonline.models.VSOnlineAccountProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'properties': {'key': 'properties', 'type': 'VSOnlineAccountProperties'}, - } - - def __init__(self, **kwargs): - super(VSOnlineAccount, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) - self.sku = kwargs.get('sku', None) - self.properties = kwargs.get('properties', None) diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_info.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_info.py deleted file mode 100644 index e4edb2b2737..00000000000 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_info.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VSOnlineAccountInfo(Model): - """VS Online Account properties. Holds properties that describe the account. - - :param sku: SKU of the service. - :type sku: ~microsoft.vsonline.models.Sku - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__(self, **kwargs): - super(VSOnlineAccountInfo, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_info_py3.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_info_py3.py deleted file mode 100644 index af39f98c4c8..00000000000 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_info_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VSOnlineAccountInfo(Model): - """VS Online Account properties. Holds properties that describe the account. - - :param sku: SKU of the service. - :type sku: ~microsoft.vsonline.models.Sku - """ - - _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__(self, *, sku=None, **kwargs) -> None: - super(VSOnlineAccountInfo, self).__init__(**kwargs) - self.sku = sku diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_paged.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_paged.py deleted file mode 100644 index fc61dd25b80..00000000000 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class VSOnlineAccountPaged(Paged): - """ - A paging container for iterating over a list of :class:`VSOnlineAccount ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[VSOnlineAccount]'} - } - - def __init__(self, *args, **kwargs): - - super(VSOnlineAccountPaged, self).__init__(*args, **kwargs) diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_properties.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_properties.py deleted file mode 100644 index 4c80686c1fe..00000000000 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_properties.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VSOnlineAccountProperties(Model): - """VS Online Additional properties. - - Additional VS Online Account properties. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param user_id: unique user assigned id. - :type user_id: str - :ivar service_uri: Service endpoint. - :vartype service_uri: str - """ - - _validation = { - 'service_uri': {'readonly': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'service_uri': {'key': 'serviceUri', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(VSOnlineAccountProperties, self).__init__(**kwargs) - self.user_id = kwargs.get('user_id', None) - self.service_uri = None diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_properties_py3.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_properties_py3.py deleted file mode 100644 index 7c0a6725fdf..00000000000 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_properties_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VSOnlineAccountProperties(Model): - """VS Online Additional properties. - - Additional VS Online Account properties. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param user_id: unique user assigned id. - :type user_id: str - :ivar service_uri: Service endpoint. - :vartype service_uri: str - """ - - _validation = { - 'service_uri': {'readonly': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'service_uri': {'key': 'serviceUri', 'type': 'str'}, - } - - def __init__(self, *, user_id: str=None, **kwargs) -> None: - super(VSOnlineAccountProperties, self).__init__(**kwargs) - self.user_id = user_id - self.service_uri = None diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_py3.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_py3.py deleted file mode 100644 index e7798daa58c..00000000000 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_account_py3.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VSOnlineAccount(Model): - """VS Online Account. Represents the high level account needed to provision VS - Online resources. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param tags: Tags for the VS Online Account - :type tags: dict[str, str] - :param location: Required. Region where the Azure resource is located. - :type location: str - :param sku: SKU of the service. - :type sku: ~microsoft.vsonline.models.Sku - :param properties: VS Online Additional properties. Additional VS Online - Account properties. - :type properties: ~microsoft.vsonline.models.VSOnlineAccountProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'properties': {'key': 'properties', 'type': 'VSOnlineAccountProperties'}, - } - - def __init__(self, *, location: str, tags=None, sku=None, properties=None, **kwargs) -> None: - super(VSOnlineAccount, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = tags - self.location = location - self.sku = sku - self.properties = properties diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_plan_properties.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_plan_properties.py index e9f2cf01b7e..e37c13c75c8 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_plan_properties.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_plan_properties.py @@ -24,6 +24,15 @@ class VSOnlinePlanProperties(Model): :type user_id: str :ivar service_uri: Service endpoint. :vartype service_uri: str + :param default_auto_suspend_delay_minutes: Specifies auto suspend interval + for environments in this plan. + :type default_auto_suspend_delay_minutes: int + :param default_environment_sku: Specifies the default environment sku name + for this plan. + :type default_environment_sku: str + :param vnet_properties: Specifies the vnet injection properties for this + plan. + :type vnet_properties: ~microsoft.vsonline.models.VnetProperties """ _validation = { @@ -33,9 +42,15 @@ class VSOnlinePlanProperties(Model): _attribute_map = { 'user_id': {'key': 'userId', 'type': 'str'}, 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'default_auto_suspend_delay_minutes': {'key': 'defaultAutoSuspendDelayMinutes', 'type': 'int'}, + 'default_environment_sku': {'key': 'defaultEnvironmentSku', 'type': 'str'}, + 'vnet_properties': {'key': 'vnetProperties', 'type': 'VnetProperties'}, } def __init__(self, **kwargs): super(VSOnlinePlanProperties, self).__init__(**kwargs) self.user_id = kwargs.get('user_id', None) self.service_uri = None + self.default_auto_suspend_delay_minutes = kwargs.get('default_auto_suspend_delay_minutes', None) + self.default_environment_sku = kwargs.get('default_environment_sku', None) + self.vnet_properties = kwargs.get('vnet_properties', None) diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_plan_properties_py3.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_plan_properties_py3.py index cc8e02d6a3f..3b4b6fa1436 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_plan_properties_py3.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vs_online_plan_properties_py3.py @@ -24,6 +24,15 @@ class VSOnlinePlanProperties(Model): :type user_id: str :ivar service_uri: Service endpoint. :vartype service_uri: str + :param default_auto_suspend_delay_minutes: Specifies auto suspend interval + for environments in this plan. + :type default_auto_suspend_delay_minutes: int + :param default_environment_sku: Specifies the default environment sku name + for this plan. + :type default_environment_sku: str + :param vnet_properties: Specifies the vnet injection properties for this + plan. + :type vnet_properties: ~microsoft.vsonline.models.VnetProperties """ _validation = { @@ -33,9 +42,15 @@ class VSOnlinePlanProperties(Model): _attribute_map = { 'user_id': {'key': 'userId', 'type': 'str'}, 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'default_auto_suspend_delay_minutes': {'key': 'defaultAutoSuspendDelayMinutes', 'type': 'int'}, + 'default_environment_sku': {'key': 'defaultEnvironmentSku', 'type': 'str'}, + 'vnet_properties': {'key': 'vnetProperties', 'type': 'VnetProperties'}, } - def __init__(self, *, user_id: str=None, **kwargs) -> None: + def __init__(self, *, user_id: str=None, default_auto_suspend_delay_minutes: int=None, default_environment_sku: str=None, vnet_properties=None, **kwargs) -> None: super(VSOnlinePlanProperties, self).__init__(**kwargs) self.user_id = user_id self.service_uri = None + self.default_auto_suspend_delay_minutes = default_auto_suspend_delay_minutes + self.default_environment_sku = default_environment_sku + self.vnet_properties = vnet_properties diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters.py index b1ba9322b26..a916e41bafa 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters.py @@ -19,14 +19,19 @@ class VSOPlanUpdateParameters(Model): :type tags: dict[str, str] :param sku: SKU of the service. :type sku: ~microsoft.vsonline.models.Sku + :param properties: Additional VS Online Plan properties. + :type properties: + ~microsoft.vsonline.models.VSOPlanUpdateParametersProperties """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + 'properties': {'key': 'properties', 'type': 'VSOPlanUpdateParametersProperties'}, } def __init__(self, **kwargs): super(VSOPlanUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_properties.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_properties.py new file mode 100644 index 00000000000..af2c7b98da9 --- /dev/null +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_properties.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class VSOPlanUpdateParametersProperties(Model): + """Additional VS Online Plan properties. + + :param default_auto_suspend_delay_minutes: Specifies auto suspend interval + for environments in this plan. + :type default_auto_suspend_delay_minutes: int + :param default_environment_sku: Specifies the default environment sku name + for this plan. + :type default_environment_sku: str + :param vnet_properties: Specifies the vnet injection properties for this + plan. + :type vnet_properties: ~microsoft.vsonline.models.VnetProperties + """ + + _attribute_map = { + 'default_auto_suspend_delay_minutes': {'key': 'defaultAutoSuspendDelayMinutes', 'type': 'int'}, + 'default_environment_sku': {'key': 'defaultEnvironmentSku', 'type': 'str'}, + 'vnet_properties': {'key': 'vnetProperties', 'type': 'VnetProperties'}, + } + + def __init__(self, **kwargs): + super(VSOPlanUpdateParametersProperties, self).__init__(**kwargs) + self.default_auto_suspend_delay_minutes = kwargs.get('default_auto_suspend_delay_minutes', None) + self.default_environment_sku = kwargs.get('default_environment_sku', None) + self.vnet_properties = kwargs.get('vnet_properties', None) diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_properties_py3.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_properties_py3.py new file mode 100644 index 00000000000..1f04671ebf5 --- /dev/null +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_properties_py3.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class VSOPlanUpdateParametersProperties(Model): + """Additional VS Online Plan properties. + + :param default_auto_suspend_delay_minutes: Specifies auto suspend interval + for environments in this plan. + :type default_auto_suspend_delay_minutes: int + :param default_environment_sku: Specifies the default environment sku name + for this plan. + :type default_environment_sku: str + :param vnet_properties: Specifies the vnet injection properties for this + plan. + :type vnet_properties: ~microsoft.vsonline.models.VnetProperties + """ + + _attribute_map = { + 'default_auto_suspend_delay_minutes': {'key': 'defaultAutoSuspendDelayMinutes', 'type': 'int'}, + 'default_environment_sku': {'key': 'defaultEnvironmentSku', 'type': 'str'}, + 'vnet_properties': {'key': 'vnetProperties', 'type': 'VnetProperties'}, + } + + def __init__(self, *, default_auto_suspend_delay_minutes: int=None, default_environment_sku: str=None, vnet_properties=None, **kwargs) -> None: + super(VSOPlanUpdateParametersProperties, self).__init__(**kwargs) + self.default_auto_suspend_delay_minutes = default_auto_suspend_delay_minutes + self.default_environment_sku = default_environment_sku + self.vnet_properties = vnet_properties diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_py3.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_py3.py index 7aa5a361870..9e04f3a3769 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_py3.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/vso_plan_update_parameters_py3.py @@ -19,14 +19,19 @@ class VSOPlanUpdateParameters(Model): :type tags: dict[str, str] :param sku: SKU of the service. :type sku: ~microsoft.vsonline.models.Sku + :param properties: Additional VS Online Plan properties. + :type properties: + ~microsoft.vsonline.models.VSOPlanUpdateParametersProperties """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + 'properties': {'key': 'properties', 'type': 'VSOPlanUpdateParametersProperties'}, } - def __init__(self, *, tags=None, sku=None, **kwargs) -> None: + def __init__(self, *, tags=None, sku=None, properties=None, **kwargs) -> None: super(VSOPlanUpdateParameters, self).__init__(**kwargs) self.tags = tags self.sku = sku + self.properties = properties diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/__init__.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/__init__.py index 786ad7356f2..2efe126b397 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/__init__.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/__init__.py @@ -10,11 +10,9 @@ # -------------------------------------------------------------------------- from .operations import Operations -from .account_operations import AccountOperations from .plan_operations import PlanOperations __all__ = [ 'Operations', - 'AccountOperations', 'PlanOperations', ] diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/account_operations.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/account_operations.py deleted file mode 100644 index f101e33b5f9..00000000000 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/account_operations.py +++ /dev/null @@ -1,460 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class AccountOperations(object): - """AccountOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to be used with the HTTP request. Constant value: "2019-07-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-07-01-preview" - - self.config = config - - def get( - self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): - """Retrieves information about a VS Online Account resource. - - Retrieves the properties of a VS Online Account. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param account_name: Name of the VS Online Plan - :type account_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VSOnlineAccount or ClientRawResponse if raw=true - :rtype: ~microsoft.vsonline.models.VSOnlineAccount or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`VSOAccountErrorResponseException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9]') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.VSOAccountErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VSOnlineAccount', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/accounts/{accountName}'} - - - def _delete_initial( - self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9]') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 204]: - raise models.VSOAccountErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes a VS Online Account resource. - - Deletes an existing VS Online Account. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param account_name: Name of the VS Online Plan - :type account_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`VSOAccountErrorResponseException` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - account_name=account_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/accounts/{accountName}'} - - def create( - self, resource_group_name, account_name, vsonline_account, custom_headers=None, raw=False, **operation_config): - """Creates a VS Online Account. - - Creates a VS Online Account with the specified create parameters. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param account_name: Name of the VS Online Plan - :type account_name: str - :param vsonline_account: VS Online Account create parameters. - :type vsonline_account: ~microsoft.vsonline.models.VSOnlineAccount - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VSOnlineAccount or ClientRawResponse if raw=true - :rtype: ~microsoft.vsonline.models.VSOnlineAccount or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`VSOAccountErrorResponseException` - """ - # Construct URL - url = self.create.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9]') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(vsonline_account, 'VSOnlineAccount') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.VSOAccountErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VSOnlineAccount', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/accounts/{accountName}'} - - def update( - self, resource_group_name, account_name, tags=None, sku=None, custom_headers=None, raw=False, **operation_config): - """Updates a VS Online Account. - - Updates the properties of an existing VS Online Account with the - specified update parameters. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param account_name: Name of the VS Online Plan - :type account_name: str - :param tags: Tags for the VS Online Account. - :type tags: dict[str, str] - :param sku: SKU of the service. - :type sku: ~microsoft.vsonline.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VSOnlineAccount or ClientRawResponse if raw=true - :rtype: ~microsoft.vsonline.models.VSOnlineAccount or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`VSOAccountErrorResponseException` - """ - vsonline_account_update_parameters = models.VSOAccountUpdateParameters(tags=tags, sku=sku) - - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9]') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(vsonline_account_update_parameters, 'VSOAccountUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.VSOAccountErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VSOnlineAccount', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/accounts/{accountName}'} - - def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Retrieves information about all VS Online Account resources under the - given subscription and resource group. - - Retrieves the properties of all VS Online Accounts. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of VSOnlineAccount - :rtype: - ~microsoft.vsonline.models.VSOnlineAccountPaged[~microsoft.vsonline.models.VSOnlineAccount] - :raises: - :class:`VSOAccountErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.VSOAccountErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.VSOnlineAccountPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.VSOnlineAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/accounts/'} - - def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): - """Retrieves information about all VS Online Account resources under the - given subscription. - - Retrieves the properties of all VS Online Accounts. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of VSOnlineAccount - :rtype: - ~microsoft.vsonline.models.VSOnlineAccountPaged[~microsoft.vsonline.models.VSOnlineAccount] - :raises: - :class:`VSOAccountErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.VSOAccountErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.VSOnlineAccountPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.VSOnlineAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VSOnline/accounts/'} diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/operations.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/operations.py index 6da7455e7d5..94ba2f58296 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/operations.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/operations.py @@ -22,7 +22,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to be used with the HTTP request. Constant value: "2019-07-01-preview". + :ivar api_version: The API version to be used with the HTTP request. Constant value: "2020-05-26-preview". """ models = models @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-07-01-preview" + self.api_version = config.api_version or "2020-05-26-preview" self.config = config diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/plan_operations.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/plan_operations.py index 9ca8a05317d..78694996225 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/plan_operations.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/operations/plan_operations.py @@ -11,8 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -24,7 +22,7 @@ class PlanOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to be used with the HTTP request. Constant value: "2019-07-01-preview". + :ivar api_version: The API version to be used with the HTTP request. Constant value: "2020-05-26-preview". """ models = models @@ -34,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-07-01-preview" + self.api_version = config.api_version or "2020-05-26-preview" self.config = config @@ -101,9 +99,26 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/plans/{planName}'} - - def _delete_initial( + def delete( self, resource_group_name, plan_name, custom_headers=None, raw=False, **operation_config): + """Deletes a VS Online Plan resource. + + Deletes an existing VS Online Plan. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param plan_name: Name of the VS Online Plan + :type plan_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`VSOPlanErrorResponseException` + """ # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -136,49 +151,6 @@ def _delete_initial( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - - def delete( - self, resource_group_name, plan_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes a VS Online Plan resource. - - Deletes an existing VS Online Plan. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param plan_name: Name of the VS Online Plan - :type plan_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`VSOPlanErrorResponseException` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - plan_name=plan_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/plans/{planName}'} def create( @@ -251,7 +223,7 @@ def create( create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/plans/{planName}'} def update( - self, resource_group_name, plan_name, tags=None, sku=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, plan_name, vsonline_plan_update_parameters, custom_headers=None, raw=False, **operation_config): """Updates a VS Online Plan. Updates the properties of an existing VS Online Plan with the specified @@ -261,10 +233,10 @@ def update( :type resource_group_name: str :param plan_name: Name of the VS Online Plan :type plan_name: str - :param tags: Tags for the VS Online Plan. - :type tags: dict[str, str] - :param sku: SKU of the service. - :type sku: ~microsoft.vsonline.models.Sku + :param vsonline_plan_update_parameters: Parameters for updating the VS + Online Plan. + :type vsonline_plan_update_parameters: + ~microsoft.vsonline.models.VSOPlanUpdateParameters :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -276,8 +248,6 @@ def update( :raises: :class:`VSOPlanErrorResponseException` """ - vsonline_plan_update_parameters = models.VSOPlanUpdateParameters(tags=tags, sku=sku) - # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -670,7 +640,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/plans/'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VSOnline/plans'} def list_by_subscription( self, custom_headers=None, raw=False, **operation_config): @@ -736,4 +706,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VSOnline/plans/'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VSOnline/plans'} diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/version.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/version.py index d7d47ad4ac7..df4483d4df9 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/version.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "07/01/2019 00:00:00" +VERSION = "05/26/2020 00:00:00" diff --git a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/vs_online_client.py b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/vs_online_client.py index e836eebf195..559d58b0d49 100644 --- a/src/codespaces/azext_codespaces/vendored_sdks/vsonline/vs_online_client.py +++ b/src/codespaces/azext_codespaces/vendored_sdks/vsonline/vs_online_client.py @@ -14,7 +14,6 @@ from msrestazure import AzureConfiguration from .version import VERSION from .operations.operations import Operations -from .operations.account_operations import AccountOperations from .operations.plan_operations import PlanOperations from . import models @@ -34,7 +33,7 @@ class VSOnlineClientConfiguration(AzureConfiguration): """ def __init__( - self, credentials, subscription_id, base_url=None): + self, credentials, subscription_id, base_url=None, api_version=None): if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") @@ -50,18 +49,17 @@ def __init__( self.credentials = credentials self.subscription_id = subscription_id + self.api_version = api_version class VSOnlineClient(SDKClient): - """Microsoft VS Online REST API version 2019-07-01-preview. + """Microsoft VS Online REST API version 2020-05-26-preview. :ivar config: Configuration for client. :vartype config: VSOnlineClientConfiguration :ivar operations: Operations operations :vartype operations: microsoft.vsonline.operations.Operations - :ivar account: Account operations - :vartype account: microsoft.vsonline.operations.AccountOperations :ivar plan: Plan operations :vartype plan: microsoft.vsonline.operations.PlanOperations @@ -75,19 +73,17 @@ class VSOnlineClient(SDKClient): """ def __init__( - self, credentials, subscription_id, base_url=None): + self, credentials, subscription_id, base_url=None, api_version=None): - self.config = VSOnlineClientConfiguration(credentials, subscription_id, base_url) + self.config = VSOnlineClientConfiguration(credentials, subscription_id, base_url, api_version) super(VSOnlineClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-07-01-preview' + self.api_version = '2020-05-26-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) - self.account = AccountOperations( - self._client, self.config, self._serialize, self._deserialize) self.plan = PlanOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/src/codespaces/azext_codespaces/version.py b/src/codespaces/azext_codespaces/version.py index e1db9d6e733..7f76f4a5955 100644 --- a/src/codespaces/azext_codespaces/version.py +++ b/src/codespaces/azext_codespaces/version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -VERSION = '0.1.0' +VERSION = '0.2.0'