From 5e804820a052eaeab1da6f05ec82caa54cc4641c Mon Sep 17 00:00:00 2001 From: Shreya Anand Date: Tue, 31 Dec 2024 06:13:42 +0000 Subject: [PATCH 1/4] playwright testing cli entension added --- src/playwright-cli-extension/HISTORY.rst | 8 + src/playwright-cli-extension/README.md | 5 + .../__init__.py | 42 ++ .../azext_playwright_cli_extension/_help.py | 11 + .../azext_playwright_cli_extension/_params.py | 13 + .../aaz/__init__.py | 6 + .../aaz/latest/__init__.py | 10 + .../latest/playwright_testing/__cmd_group.py | 23 + .../aaz/latest/playwright_testing/__init__.py | 12 + .../_check_name_availability.py | 176 +++++++ .../playwright_testing/quota/__cmd_group.py | 23 + .../playwright_testing/quota/__init__.py | 13 + .../latest/playwright_testing/quota/_list.py | 226 +++++++++ .../latest/playwright_testing/quota/_show.py | 225 +++++++++ .../workspace/__cmd_group.py | 23 + .../playwright_testing/workspace/__init__.py | 17 + .../playwright_testing/workspace/_create.py | 328 ++++++++++++ .../playwright_testing/workspace/_delete.py | 169 +++++++ .../playwright_testing/workspace/_list.py | 389 +++++++++++++++ .../playwright_testing/workspace/_show.py | 233 +++++++++ .../playwright_testing/workspace/_update.py | 467 ++++++++++++++++++ .../playwright_testing/workspace/_wait.py | 229 +++++++++ .../workspace/quota/__cmd_group.py | 23 + .../workspace/quota/__init__.py | 13 + .../workspace/quota/_list.py | 249 ++++++++++ .../workspace/quota/_show.py | 248 ++++++++++ .../azext_metadata.json | 4 + .../commands.py | 15 + .../azext_playwright_cli_extension/custom.py | 14 + .../tests/__init__.py | 6 + .../tests/latest/__init__.py | 6 + .../test_create_playwright_workspace.yaml | 176 +++++++ .../test_delete_playwright_workspace.yaml | 48 ++ ...list_playwright_quota_by_subscription.yaml | 61 +++ .../test_list_playwright_workspaces.yaml | 50 ++ ..._playwright_workspace_quota_not_found.yaml | 66 +++ .../test_show_playwright_quota_by_name.yaml | 61 +++ .../test_show_playwright_workspace.yaml | 52 ++ .../test_update_playwright_workspace.yaml | 226 +++++++++ .../latest/test_playwright_cli_extension.py | 225 +++++++++ src/playwright-cli-extension/setup.cfg | 1 + src/playwright-cli-extension/setup.py | 49 ++ 42 files changed, 4241 insertions(+) create mode 100644 src/playwright-cli-extension/HISTORY.rst create mode 100644 src/playwright-cli-extension/README.md create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/_help.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/_params.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/__cmd_group.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/_check_name_availability.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/__cmd_group.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/_list.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/_show.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/__cmd_group.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_create.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_delete.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_list.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_show.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_update.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_wait.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/__cmd_group.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/_list.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/_show.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/azext_metadata.json create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/commands.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/custom.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/__init__.py create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_create_playwright_workspace.yaml create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_delete_playwright_workspace.yaml create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_list_playwright_quota_by_subscription.yaml create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_list_playwright_workspaces.yaml create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_playwright_workspace_quota_not_found.yaml create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_show_playwright_quota_by_name.yaml create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_show_playwright_workspace.yaml create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_update_playwright_workspace.yaml create mode 100644 src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/test_playwright_cli_extension.py create mode 100644 src/playwright-cli-extension/setup.cfg create mode 100644 src/playwright-cli-extension/setup.py diff --git a/src/playwright-cli-extension/HISTORY.rst b/src/playwright-cli-extension/HISTORY.rst new file mode 100644 index 00000000000..abbff5a61a7 --- /dev/null +++ b/src/playwright-cli-extension/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +1.0.0b1 +++++++ +* Initial release. \ No newline at end of file diff --git a/src/playwright-cli-extension/README.md b/src/playwright-cli-extension/README.md new file mode 100644 index 00000000000..df39a38038d --- /dev/null +++ b/src/playwright-cli-extension/README.md @@ -0,0 +1,5 @@ +# Azure CLI PlaywrightCliExtension Extension # +This is an extension to Azure CLI to manage PlaywrightCliExtension resources. + +## How to use ## +Please add commands usage here. \ No newline at end of file diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/__init__.py new file mode 100644 index 00000000000..15a3c3c4232 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/__init__.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_playwright_cli_extension._help import helps # pylint: disable=unused-import + + +class PlaywrightCliExtensionCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_playwright_cli_extension.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_playwright_cli_extension.commands import load_command_table + from azure.cli.core.aaz import load_aaz_command_table + try: + from . import aaz + except ImportError: + aaz = None + if aaz: + load_aaz_command_table( + loader=self, + aaz_pkg_name=aaz.__name__, + args=args + ) + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from azext_playwright_cli_extension._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = PlaywrightCliExtensionCommandsLoader diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/_help.py b/src/playwright-cli-extension/azext_playwright_cli_extension/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/_help.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/_params.py b/src/playwright-cli-extension/azext_playwright_cli_extension/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/_params.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + + +def load_arguments(self, _): # pylint: disable=unused-argument + pass diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/__init__.py new file mode 100644 index 00000000000..f6acc11aa4e --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/__init__.py @@ -0,0 +1,10 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/__cmd_group.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/__cmd_group.py new file mode 100644 index 00000000000..e9f299f9501 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "playwright-testing", +) +class __CMDGroup(AAZCommandGroup): + """Manage Microsoft Playwright Testing service + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/__init__.py new file mode 100644 index 00000000000..be757259c47 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._check_name_availability import * diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/_check_name_availability.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/_check_name_availability.py new file mode 100644 index 00000000000..1065c47b756 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/_check_name_availability.py @@ -0,0 +1,176 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing check-name-availability", +) +class CheckNameAvailability(AAZCommand): + """Adds check global name availability operation, normally used if a resource name must be globally unique. + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.azureplaywrightservice/checknameavailability", "2024-12-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["--name"], + arg_group="Body", + help="The name of the resource for which availability needs to be checked.", + ) + _args_schema.type = AAZStrArg( + options=["--type"], + arg_group="Body", + help="The resource type.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccountsCheckNameAvailability(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AccountsCheckNameAvailability(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("name", AAZStrType, ".name") + _builder.set_prop("type", AAZStrType, ".type") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.message = AAZStrType() + _schema_on_200.name_available = AAZBoolType( + serialized_name="nameAvailable", + ) + _schema_on_200.reason = AAZStrType() + + return cls._schema_on_200 + + +class _CheckNameAvailabilityHelper: + """Helper class for CheckNameAvailability""" + + +__all__ = ["CheckNameAvailability"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/__cmd_group.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/__cmd_group.py new file mode 100644 index 00000000000..863fb0fb6d7 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "playwright-testing quota", +) +class __CMDGroup(AAZCommandGroup): + """Manage Azure subscription quota resource for Microsoft Playwright Testing service + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/_list.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/_list.py new file mode 100644 index 00000000000..e9a1f6097ba --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/_list.py @@ -0,0 +1,226 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing quota list", +) +class List(AAZCommand): + """List quotas for a given subscription Id. + + :example: List Playwright Testing Quotas by Subscription + az playwright-testing quota list --location eastus + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.azureplaywrightservice/locations/{}/quotas", "2024-12-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + help="The location of subscription quota resource.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.QuotasListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class QuotasListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "location", self.ctx.args.location, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.free_trial = AAZObjectType( + serialized_name="freeTrial", + ) + properties.offering_type = AAZStrType( + serialized_name="offeringType", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + free_trial = cls._schema_on_200.value.Element.properties.free_trial + free_trial.account_id = AAZStrType( + serialized_name="accountId", + flags={"read_only": True}, + ) + free_trial.state = AAZStrType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/_show.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/_show.py new file mode 100644 index 00000000000..b61cbd7a11d --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/quota/_show.py @@ -0,0 +1,225 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing quota show", +) +class Show(AAZCommand): + """Get subscription quota by name. + + :example: Get Playwright Testing Quotas by Subscription + az playwright-testing quota show --location eastus --quota-name ScalableExecution + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.azureplaywrightservice/locations/{}/quotas/{}", "2024-12-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + help="The location of subscription quota resource.", + required=True, + id_part="name", + ) + _args_schema.quota_name = AAZStrArg( + options=["--quota-name"], + help="The Microsoft Playwright Testing service workspace quota name.", + required=True, + id_part="child_name_1", + enum={"Reporting": "Reporting", "ScalableExecution": "ScalableExecution"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.QuotasGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class QuotasGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "location", self.ctx.args.location, + required=True, + ), + **self.serialize_url_param( + "quotaName", self.ctx.args.quota_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.free_trial = AAZObjectType( + serialized_name="freeTrial", + ) + properties.offering_type = AAZStrType( + serialized_name="offeringType", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + free_trial = cls._schema_on_200.properties.free_trial + free_trial.account_id = AAZStrType( + serialized_name="accountId", + flags={"read_only": True}, + ) + free_trial.state = AAZStrType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/__cmd_group.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/__cmd_group.py new file mode 100644 index 00000000000..ecf729bfa9f --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "playwright-testing workspace", +) +class __CMDGroup(AAZCommandGroup): + """Manage Microsoft Playwright Testing service workspace resource + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_create.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_create.py new file mode 100644 index 00000000000..eb1f32eba1d --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_create.py @@ -0,0 +1,328 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing workspace create", +) +class Create(AAZCommand): + """Create a Microsoft Playwright Testing service Workspace resource + + :example: Create Playwright Testing Workspace + az playwright-testing workspace create --resource-group SampleRG --workspace-name myPlaywrightWorkspace --location westus --regional-affinity Enabled + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azureplaywrightservice/accounts/{}", "2024-12-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.workspace_name = AAZStrArg( + options=["-n", "--name", "--workspace-name"], + help="Name of Microsoft Azure Playwright Testing service workspace.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$", + max_length=64, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of Azure resource group", + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.local_auth = AAZStrArg( + options=["--local-auth"], + arg_group="Properties", + help="When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs.", + default="Disabled", + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + _args_schema.regional_affinity = AAZStrArg( + options=["--regional-affinity"], + arg_group="Properties", + help="This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created.", + default="Enabled", + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + _args_schema.reporting = AAZStrArg( + options=["--reporting"], + arg_group="Properties", + help="When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting.", + default="Enabled", + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + _args_schema.scalable_execution = AAZStrArg( + options=["--scalable-execution"], + arg_group="Properties", + help="When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations.", + default="Enabled", + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AccountsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AccountsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.workspace_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("localAuth", AAZStrType, ".local_auth") + properties.set_prop("regionalAffinity", AAZStrType, ".regional_affinity") + properties.set_prop("reporting", AAZStrType, ".reporting") + properties.set_prop("scalableExecution", AAZStrType, ".scalable_execution") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.dashboard_uri = AAZStrType( + serialized_name="dashboardUri", + flags={"read_only": True}, + ) + properties.local_auth = AAZStrType( + serialized_name="localAuth", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.regional_affinity = AAZStrType( + serialized_name="regionalAffinity", + ) + properties.reporting = AAZStrType() + properties.scalable_execution = AAZStrType( + serialized_name="scalableExecution", + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_delete.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_delete.py new file mode 100644 index 00000000000..ebfbffe9b6f --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_delete.py @@ -0,0 +1,169 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing workspace delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete Microsoft Azure Playwright Testing service Workspace resource + + :example: Delete Playwright Testing Workspace + az playwright-testing workspace delete --resource-group SampleRG --workspace-name myPlaywrightWorkspace + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azureplaywrightservice/accounts/{}", "2024-12-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.workspace_name = AAZStrArg( + options=["-n", "--name", "--workspace-name"], + help="Name of Microsoft Azure Playwright Testing service workspace.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$", + max_length=64, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of Azure resource group", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AccountsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class AccountsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.workspace_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_list.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_list.py new file mode 100644 index 00000000000..2be4e242160 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_list.py @@ -0,0 +1,389 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing workspace list", +) +class List(AAZCommand): + """List Microsoft Azure Playwright Testing service Workspace resources by subscription ID + + :example: Playwright Testing Workspace_ListBySubscription + az playwright-testing workspace list + + :example: Playwright Testing Workspace_ListByResourceGroup + az playwright-testing workspace list --resource-group SampleRG + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.azureplaywrightservice/accounts", "2024-12-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azureplaywrightservice/accounts", "2024-12-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of Azure resource group", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + if condition_0: + self.AccountsListBySubscription(ctx=self.ctx)() + if condition_1: + self.AccountsListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class AccountsListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.dashboard_uri = AAZStrType( + serialized_name="dashboardUri", + flags={"read_only": True}, + ) + properties.local_auth = AAZStrType( + serialized_name="localAuth", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.regional_affinity = AAZStrType( + serialized_name="regionalAffinity", + ) + properties.reporting = AAZStrType() + properties.scalable_execution = AAZStrType( + serialized_name="scalableExecution", + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class AccountsListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.dashboard_uri = AAZStrType( + serialized_name="dashboardUri", + flags={"read_only": True}, + ) + properties.local_auth = AAZStrType( + serialized_name="localAuth", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.regional_affinity = AAZStrType( + serialized_name="regionalAffinity", + ) + properties.reporting = AAZStrType() + properties.scalable_execution = AAZStrType( + serialized_name="scalableExecution", + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_show.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_show.py new file mode 100644 index 00000000000..2e85f8baf0f --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_show.py @@ -0,0 +1,233 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing workspace show", +) +class Show(AAZCommand): + """Get a Microsoft Azure Playwright Testing service Workspace resource details + + :example: Get Playwright Testing Workspace + az playwright-testing workspace show --resource-group SampleRG --workspace-name myPlaywrightWorkspace + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azureplaywrightservice/accounts/{}", "2024-12-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.workspace_name = AAZStrArg( + options=["-n", "--name", "--workspace-name"], + help="Name of Microsoft Azure Playwright Testing service workspace.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$", + max_length=64, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of Azure resource group", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccountsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AccountsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.workspace_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.dashboard_uri = AAZStrType( + serialized_name="dashboardUri", + flags={"read_only": True}, + ) + properties.local_auth = AAZStrType( + serialized_name="localAuth", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.regional_affinity = AAZStrType( + serialized_name="regionalAffinity", + ) + properties.reporting = AAZStrType() + properties.scalable_execution = AAZStrType( + serialized_name="scalableExecution", + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_update.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_update.py new file mode 100644 index 00000000000..e4193cb073c --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_update.py @@ -0,0 +1,467 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing workspace update", +) +class Update(AAZCommand): + """Update Microsoft Azure Playwright Testing service Workspace resource + + :example: Update Playwright Testing Workspace_Disable Regional Affinity + az playwright-testing workspace update --resource-group SampleRG --workspace-name myPlaywrightWorkspace --regional-affinity Disabled + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azureplaywrightservice/accounts/{}", "2024-12-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.workspace_name = AAZStrArg( + options=["-n", "--name", "--workspace-name"], + help="Name of Microsoft Azure Playwright Testing service workspace.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$", + max_length=64, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of Azure resource group", + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.local_auth = AAZStrArg( + options=["--local-auth"], + arg_group="Properties", + help="When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs.", + nullable=True, + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + _args_schema.regional_affinity = AAZStrArg( + options=["--regional-affinity"], + arg_group="Properties", + help="This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created.", + nullable=True, + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + _args_schema.reporting = AAZStrArg( + options=["--reporting"], + arg_group="Properties", + help="When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting.", + nullable=True, + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + _args_schema.scalable_execution = AAZStrArg( + options=["--scalable-execution"], + arg_group="Properties", + help="When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations.", + nullable=True, + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccountsGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + yield self.AccountsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AccountsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.workspace_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_account_read(cls._schema_on_200) + + return cls._schema_on_200 + + class AccountsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.workspace_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_account_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("localAuth", AAZStrType, ".local_auth") + properties.set_prop("regionalAffinity", AAZStrType, ".regional_affinity") + properties.set_prop("reporting", AAZStrType, ".reporting") + properties.set_prop("scalableExecution", AAZStrType, ".scalable_execution") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_account_read = None + + @classmethod + def _build_schema_account_read(cls, _schema): + if cls._schema_account_read is not None: + _schema.id = cls._schema_account_read.id + _schema.location = cls._schema_account_read.location + _schema.name = cls._schema_account_read.name + _schema.properties = cls._schema_account_read.properties + _schema.system_data = cls._schema_account_read.system_data + _schema.tags = cls._schema_account_read.tags + _schema.type = cls._schema_account_read.type + return + + cls._schema_account_read = _schema_account_read = AAZObjectType() + + account_read = _schema_account_read + account_read.id = AAZStrType( + flags={"read_only": True}, + ) + account_read.location = AAZStrType( + flags={"required": True}, + ) + account_read.name = AAZStrType( + flags={"read_only": True}, + ) + account_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + account_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + account_read.tags = AAZDictType() + account_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_account_read.properties + properties.dashboard_uri = AAZStrType( + serialized_name="dashboardUri", + flags={"read_only": True}, + ) + properties.local_auth = AAZStrType( + serialized_name="localAuth", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.regional_affinity = AAZStrType( + serialized_name="regionalAffinity", + ) + properties.reporting = AAZStrType() + properties.scalable_execution = AAZStrType( + serialized_name="scalableExecution", + ) + + system_data = _schema_account_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_account_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_account_read.id + _schema.location = cls._schema_account_read.location + _schema.name = cls._schema_account_read.name + _schema.properties = cls._schema_account_read.properties + _schema.system_data = cls._schema_account_read.system_data + _schema.tags = cls._schema_account_read.tags + _schema.type = cls._schema_account_read.type + + +__all__ = ["Update"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_wait.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_wait.py new file mode 100644 index 00000000000..5cf8bc5387b --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/_wait.py @@ -0,0 +1,229 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing workspace wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azureplaywrightservice/accounts/{}", "2024-12-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.workspace_name = AAZStrArg( + options=["-n", "--name", "--workspace-name"], + help="Name of Microsoft Azure Playwright Testing service workspace.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$", + max_length=64, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of Azure resource group", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccountsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class AccountsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.workspace_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.dashboard_uri = AAZStrType( + serialized_name="dashboardUri", + flags={"read_only": True}, + ) + properties.local_auth = AAZStrType( + serialized_name="localAuth", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.regional_affinity = AAZStrType( + serialized_name="regionalAffinity", + ) + properties.reporting = AAZStrType() + properties.scalable_execution = AAZStrType( + serialized_name="scalableExecution", + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/__cmd_group.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/__cmd_group.py new file mode 100644 index 00000000000..869adc516aa --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "playwright-testing workspace quota", +) +class __CMDGroup(AAZCommandGroup): + """Manage Quota resource for Microsoft Azure Playwright Testing service account + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/_list.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/_list.py new file mode 100644 index 00000000000..ab1c2d0277e --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/_list.py @@ -0,0 +1,249 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing workspace quota list", +) +class List(AAZCommand): + """List quotas for a given workspace. + + :example: List Playwright Testing Workspace Quotas + az playwright-testing workspace quota list --resource-group SampleRG --workspace-name myPlaywrightWorkspace + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azureplaywrightservice/accounts/{}/quotas", "2024-12-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.workspace_name = AAZStrArg( + options=["-n", "--name", "--workspace-name"], + help="Name of Microsoft Azure Playwright Testing service workspace.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$", + max_length=64, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of Azure resource group", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccountQuotasListByAccount(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class AccountQuotasListByAccount(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.workspace_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.free_trial = AAZObjectType( + serialized_name="freeTrial", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + free_trial = cls._schema_on_200.value.Element.properties.free_trial + free_trial.allocated_value = AAZIntType( + serialized_name="allocatedValue", + flags={"read_only": True}, + ) + free_trial.created_at = AAZStrType( + serialized_name="createdAt", + flags={"read_only": True}, + ) + free_trial.expiry_at = AAZStrType( + serialized_name="expiryAt", + flags={"read_only": True}, + ) + free_trial.percentage_used = AAZFloatType( + serialized_name="percentageUsed", + flags={"read_only": True}, + ) + free_trial.used_value = AAZIntType( + serialized_name="usedValue", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/_show.py b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/_show.py new file mode 100644 index 00000000000..40dac03dee8 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/aaz/latest/playwright_testing/workspace/quota/_show.py @@ -0,0 +1,248 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "playwright-testing workspace quota show", +) +class Show(AAZCommand): + """Get quota by name for an workspace. + + :example: Get Playwright Testing Workspace Quotas + az playwright-testing workspace quota show --resource-group SampleRG --workspace-name myPlaywrightWorkspace --quota-name ScalableExecution + """ + + _aaz_info = { + "version": "2024-12-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azureplaywrightservice/accounts/{}/quotas/{}", "2024-12-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.workspace_name = AAZStrArg( + options=["-n", "--name", "--workspace-name"], + help="Name of Microsoft Azure Playwright Testing service workspace.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$", + max_length=64, + min_length=3, + ), + ) + _args_schema.quota_name = AAZStrArg( + options=["--quota-name"], + help="The Microsoft Playwright Testing service workspace quota name.", + required=True, + id_part="child_name_1", + enum={"Reporting": "Reporting", "ScalableExecution": "ScalableExecution"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of Azure resource group", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccountQuotasGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AccountQuotasGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.workspace_name, + required=True, + ), + **self.serialize_url_param( + "quotaName", self.ctx.args.quota_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-12-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.free_trial = AAZObjectType( + serialized_name="freeTrial", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + free_trial = cls._schema_on_200.properties.free_trial + free_trial.allocated_value = AAZIntType( + serialized_name="allocatedValue", + flags={"read_only": True}, + ) + free_trial.created_at = AAZStrType( + serialized_name="createdAt", + flags={"read_only": True}, + ) + free_trial.expiry_at = AAZStrType( + serialized_name="expiryAt", + flags={"read_only": True}, + ) + free_trial.percentage_used = AAZFloatType( + serialized_name="percentageUsed", + flags={"read_only": True}, + ) + free_trial.used_value = AAZIntType( + serialized_name="usedValue", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/azext_metadata.json b/src/playwright-cli-extension/azext_playwright_cli_extension/azext_metadata.json new file mode 100644 index 00000000000..b2e481ecb9e --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.67.0" +} \ No newline at end of file diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/commands.py b/src/playwright-cli-extension/azext_playwright_cli_extension/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/commands.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +# from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): # pylint: disable=unused-argument + pass diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/custom.py b/src/playwright-cli-extension/azext_playwright_cli_extension/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/custom.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.log import get_logger + + +logger = get_logger(__name__) diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/__init__.py b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_create_playwright_workspace.yaml b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_create_playwright_workspace.yaml new file mode 100644 index 00000000000..cfac8cedcc3 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_create_playwright_workspace.yaml @@ -0,0 +1,176 @@ +interactions: +- request: + body: '{"location": "eastus", "properties": {"localAuth": "Disabled", "regionalAffinity": + "Enabled", "reporting": "Enabled", "scalableExecution": "Enabled"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace create + Connection: + - keep-alive + Content-Length: + - '150' + Content-Type: + - application/json + ParameterSetName: + - --resource-group --workspace-name --location + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4?api-version=2024-12-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4","name":"testingworkspaceap4","type":"microsoft.azureplaywrightservice/accounts","location":"eastus","systemData":{"createdBy":"shreyaanand@microsoft.com","createdByType":"User","createdAt":"2024-12-30T20:58:38.0223255Z","lastModifiedBy":"shreyaanand@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2024-12-30T20:58:38.0223255Z"},"properties":{"dashboardUri":"https://playwright.microsoft.com/workspaces/eastus_d63658af-3a0f-4958-a071-0d645c6f77ed","regionalAffinity":"Enabled","reporting":"Enabled","scalableExecution":"Enabled","provisioningState":"Accepted","localAuth":"Disabled"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/EASTUS/operationStatuses/d593cf30-ee7f-407a-aa86-aa7897684bf6*6F3B34C42603DBA956C442863A7C536BC86B9D4CBCA21A80C267D243D3F99E27?api-version=2024-12-01&t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BBAGCN3sEAjAfBgNVHSMEGDAWgBR61hmFKHlscXYeYPjzS--iBUIWHTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBABmO88-7XRCIXOiojIRFVE6cNJ-T71-dYJW-Ued6MhWFUF1zSFvymU_uRv1_bEg_TyrZ750tgpd1H9PhKFlhiHwwz-j83cJmyKo0hYqzk6i5Zx_p5TXpgHTb7OpBsJ7P48Y4Ppsvzxd3QVtUd9ilvCEV-XQJ7fhkKZ13600A6um1pMWXYAAUwkzdm3un8uHXua6Nq-l2vM3z1ZTyjAgj7nvYa7o5ZNs_OcOy2wJMMdqFC889ZaT5MnwhxvMuCwk4oC2qeCYPhlozGGTQ2A2_2d9abDdl6nUk7gqcnJBKzXGM2vpZdzRFR2oN6Kpu1p_5pUtwpvTrpTef5ByUqFnYAY8&s=VyK-B3p5f_l6xnpChhrPb1KQImkTMmuVVMU89Vz3dfGnygQhZ8fFG_PligR4rf7zOdyFVHLCLQtpWACucwXKvK6D79tJehe195Zgn3-N2WoK-isGNjA392EYS9TWYcJxC1aH35kZgnJvWNF_o_5Gm4xVxxdN26NpHiKCznXOEQF8NS3WKGe9PKI7q9utpbIwsaOfwI1G-NgZqFErun5gi48nIunRgHQhSOLuO5dD6WP6I-bTWsQpM9PeORsZYY6Abkxje82zU_IhiEiLdERdpL1IQJgXoVVrDzrFbn5S341NvTiUlt0d3_d1AYao7tUJBg_q__gftA0IhfZ0rkEb-g&h=a-UognYIc4SEAbdAOOYgRIHMFQVScZXAyWnSV9eFaz8 + cache-control: + - no-cache + content-length: + - '767' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 20:58:38 GMT + etag: + - '"a604d88c-0000-0100-0000-6773097f0000"' + expires: + - '-1' + mise-correlation-id: + - 39276a2c-2a9c-4023-b91b-4a702458c250 + pragma: + - no-cache + set-cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + Path=/; Secure; HttpOnly; + - ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + SameSite=none; Path=/; Secure; HttpOnly; + strict-transport-security: + - max-age=31536000; includeSubDomains + x-azure-ref: + - 20241230T205838Z-175dd4d56777n7xdhC1MNZms3s0000001mag00000000u9pf + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-correlation-id: + - f39e8a80-0e5b-475a-9d0e-730b807773e2 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: 28517CDFA29F4DD0BBAFB481819FC8F0 Ref B: MAA201060515045 Ref C: 2024-12-30T20:58:33Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace create + Connection: + - keep-alive + Cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345 + ParameterSetName: + - --resource-group --workspace-name --location + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/EASTUS/operationStatuses/d593cf30-ee7f-407a-aa86-aa7897684bf6*6F3B34C42603DBA956C442863A7C536BC86B9D4CBCA21A80C267D243D3F99E27?api-version=2024-12-01&t=638711891193974025&c=MIIHhzCCBm-gAwIBAgITfAWKSDa5exA4mgXQ1AAABYpINjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgw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VE6cNJ-T71-dYJW-Ued6MhWFUF1zSFvymU_uRv1_bEg_TyrZ750tgpd1H9PhKFlhiHwwz-j83cJmyKo0hYqzk6i5Zx_p5TXpgHTb7OpBsJ7P48Y4Ppsvzxd3QVtUd9ilvCEV-XQJ7fhkKZ13600A6um1pMWXYAAUwkzdm3un8uHXua6Nq-l2vM3z1ZTyjAgj7nvYa7o5ZNs_OcOy2wJMMdqFC889ZaT5MnwhxvMuCwk4oC2qeCYPhlozGGTQ2A2_2d9abDdl6nUk7gqcnJBKzXGM2vpZdzRFR2oN6Kpu1p_5pUtwpvTrpTef5ByUqFnYAY8&s=VyK-B3p5f_l6xnpChhrPb1KQImkTMmuVVMU89Vz3dfGnygQhZ8fFG_PligR4rf7zOdyFVHLCLQtpWACucwXKvK6D79tJehe195Zgn3-N2WoK-isGNjA392EYS9TWYcJxC1aH35kZgnJvWNF_o_5Gm4xVxxdN26NpHiKCznXOEQF8NS3WKGe9PKI7q9utpbIwsaOfwI1G-NgZqFErun5gi48nIunRgHQhSOLuO5dD6WP6I-bTWsQpM9PeORsZYY6Abkxje82zU_IhiEiLdERdpL1IQJgXoVVrDzrFbn5S341NvTiUlt0d3_d1AYao7tUJBg_q__gftA0IhfZ0rkEb-g&h=a-UognYIc4SEAbdAOOYgRIHMFQVScZXAyWnSV9eFaz8 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/EASTUS/operationStatuses/d593cf30-ee7f-407a-aa86-aa7897684bf6*6F3B34C42603DBA956C442863A7C536BC86B9D4CBCA21A80C267D243D3F99E27","name":"d593cf30-ee7f-407a-aa86-aa7897684bf6*6F3B34C42603DBA956C442863A7C536BC86B9D4CBCA21A80C267D243D3F99E27","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4","status":"Succeeded","startTime":"2024-12-30T20:58:38.3577767Z","endTime":"2024-12-30T20:58:39.2044146Z","properties":null}' + headers: + cache-control: + - no-cache + content-length: + - '651' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 20:58:39 GMT + etag: + - '"f4073151-0000-0100-0000-6773097f0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 6B8F2CB3144C4F7F9D44E073EC6DBA49 Ref B: MAA201060515045 Ref C: 2024-12-30T20:58:39Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace create + Connection: + - keep-alive + Cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345 + ParameterSetName: + - --resource-group --workspace-name --location + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4?api-version=2024-12-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4","name":"testingworkspaceap4","type":"microsoft.azureplaywrightservice/accounts","location":"eastus","systemData":{"createdBy":"shreyaanand@microsoft.com","createdByType":"User","createdAt":"2024-12-30T20:58:38.0223255Z","lastModifiedBy":"shreyaanand@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2024-12-30T20:58:38.0223255Z"},"properties":{"dashboardUri":"https://playwright.microsoft.com/workspaces/eastus_d63658af-3a0f-4958-a071-0d645c6f77ed","regionalAffinity":"Enabled","reporting":"Enabled","scalableExecution":"Enabled","provisioningState":"Succeeded","localAuth":"Disabled"}}' + headers: + cache-control: + - no-cache + content-length: + - '768' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 20:58:40 GMT + etag: + - '"a604de8c-0000-0100-0000-6773097f0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 05AB3CA756AF4F1C91473A7DEDB5FB89 Ref B: MAA201060515045 Ref C: 2024-12-30T20:58:40Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_delete_playwright_workspace.yaml b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_delete_playwright_workspace.yaml new file mode 100644 index 00000000000..a8ee1430267 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_delete_playwright_workspace.yaml @@ -0,0 +1,48 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --workspace-name --yes + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4?api-version=2024-12-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Mon, 30 Dec 2024 21:17:31 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '799' + x-ms-ratelimit-remaining-subscription-global-deletes: + - '11999' + x-msedge-ref: + - 'Ref A: B95F1B76328C47E099F2F9D671D02F70 Ref B: MAA201060515045 Ref C: 2024-12-30T21:17:31Z' + status: + code: 204 + message: No Content +version: 1 diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_list_playwright_quota_by_subscription.yaml b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_list_playwright_quota_by_subscription.yaml new file mode 100644 index 00000000000..1e1bf9f97c8 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_list_playwright_quota_by_subscription.yaml @@ -0,0 +1,61 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing quota list + Connection: + - keep-alive + ParameterSetName: + - --location + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/eastus/quotas?api-version=2024-12-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/eastus/quotas/ScalableExecution","name":"ScalableExecution","type":"Microsoft.AzurePlaywrightService/locations/quotas","properties":{"freeTrial":{"accountId":"eastus2euap_63f7d7ba-8ffd-46b4-9576-6deb0eab9ac7","state":"Expired"},"provisioningState":"Succeeded","offeringType":"NotApplicable"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/eastus/quotas/Reporting","name":"Reporting","type":"Microsoft.AzurePlaywrightService/locations/quotas","properties":{"freeTrial":{"accountId":"eastus2euap_63f7d7ba-8ffd-46b4-9576-6deb0eab9ac7","state":"Expired"},"provisioningState":"Succeeded","offeringType":"PublicPreview"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '805' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 20:47:10 GMT + expires: + - '-1' + mise-correlation-id: + - 9b0bec46-37a3-493a-ae91-7a1d6608d2f6 + pragma: + - no-cache + set-cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + Path=/; Secure; HttpOnly; + - ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + SameSite=none; Path=/; Secure; HttpOnly; + strict-transport-security: + - max-age=31536000; includeSubDomains + x-azure-ref: + - 20241230T204710Z-r1fc5bf4d66n6d66hC1MNZcnzs0000000nzg00000000mq8y + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-correlation-id: + - 247656f4-a568-4b04-a4ec-a620fb2ec839 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: EA769B45E9CE4ED4B92709708025BA7D Ref B: MAA201060516019 Ref C: 2024-12-30T20:47:09Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_list_playwright_workspaces.yaml b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_list_playwright_workspaces.yaml new file mode 100644 index 00000000000..13f9dd94278 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_list_playwright_workspaces.yaml @@ -0,0 +1,50 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace list + Connection: + - keep-alive + ParameterSetName: + - --resource-group + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts?api-version=2024-12-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap2","name":"testingworkspaceap2","type":"microsoft.azureplaywrightservice/accounts","location":"eastus","systemData":{"createdBy":"amitprakash@microsoft.com","createdByType":"User","createdAt":"2023-07-18T10:08:15.6683306Z","lastModifiedBy":"5882560c-fcff-49a8-9b02-8a3e08428404","lastModifiedByType":"Application","lastModifiedAt":"2024-09-10T11:52:38.3381016Z"},"properties":{"regionalAffinity":"Enabled","provisioningState":"Succeeded","localAuth":"Enabled"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightWorkspace","name":"myPlaywrightWorkspace","type":"microsoft.azureplaywrightservice/accounts","location":"eastus","systemData":{"createdBy":"shreyaanand@microsoft.com","createdByType":"User","createdAt":"2024-12-30T20:54:53.7829772Z","lastModifiedBy":"shreyaanand@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2024-12-30T20:54:53.7829772Z"},"properties":{"dashboardUri":"https://playwright.microsoft.com/workspaces/eastus_247a79a2-9e2a-470a-9805-fb38ebb5b02d","regionalAffinity":"Enabled","reporting":"Enabled","scalableExecution":"Enabled","provisioningState":"Succeeded","localAuth":"Disabled"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1413' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 21:23:44 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 5108E9A8B8964292B5AA59D457B12697 Ref B: MAA201060515045 Ref C: 2024-12-30T21:23:44Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_playwright_workspace_quota_not_found.yaml b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_playwright_workspace_quota_not_found.yaml new file mode 100644 index 00000000000..c8cffee8f68 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_playwright_workspace_quota_not_found.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace quota show + Connection: + - keep-alive + ParameterSetName: + - --resource-group --workspace-name --quota-name + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap2/quotas/ScalableExecution?api-version=2024-12-01 + response: + body: + string: '{"error":{"code":"NotFound","message":"The data for the account or + free-trial was not found. Please check the request and try again."}}' + headers: + cache-control: + - no-cache + content-length: + - '135' + content-type: + - application/json + date: + - Mon, 30 Dec 2024 20:33:04 GMT + expires: + - '-1' + mise-correlation-id: + - 1ea4f04c-f7ad-4264-83df-7a87de048c04 + pragma: + - no-cache + set-cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + Path=/; Secure; HttpOnly; + - ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + SameSite=none; Path=/; Secure; HttpOnly; + strict-transport-security: + - max-age=31536000; includeSubDomains + user-agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + x-azure-ref: + - 20241230T203305Z-17f6b595578x9dg7hC1BN1v17000000003t000000000ptsb + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-correlation-id: + - c1d97466-ff32-4147-aa71-4c1143c9d590 + x-ms-failure-cause: + - service + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 827C563025484A53B258DE740127DF28 Ref B: MAA201060516019 Ref C: 2024-12-30T20:33:04Z' + status: + code: 404 + message: Not Found +version: 1 diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_show_playwright_quota_by_name.yaml b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_show_playwright_quota_by_name.yaml new file mode 100644 index 00000000000..cbe3558bb8e --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_show_playwright_quota_by_name.yaml @@ -0,0 +1,61 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing quota show + Connection: + - keep-alive + ParameterSetName: + - --location --quota-name + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/eastus/quotas/ScalableExecution?api-version=2024-12-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/eastus/quotas/ScalableExecution","name":"ScalableExecution","type":"Microsoft.AzurePlaywrightService/locations/quotas","properties":{"freeTrial":{"accountId":"eastus2euap_63f7d7ba-8ffd-46b4-9576-6deb0eab9ac7","state":"Expired"},"provisioningState":"Succeeded","offeringType":"NotApplicable"}}' + headers: + cache-control: + - no-cache + content-length: + - '404' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 20:50:08 GMT + expires: + - '-1' + mise-correlation-id: + - 989c8e3c-3242-4fe4-b5fd-06f3c9d8cf12 + pragma: + - no-cache + set-cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + Path=/; Secure; HttpOnly; + - ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + SameSite=none; Path=/; Secure; HttpOnly; + strict-transport-security: + - max-age=31536000; includeSubDomains + x-azure-ref: + - 20241230T205008Z-175dd4d5677sxjpfhC1MNZbvyc0000001my0000000003x23 + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-correlation-id: + - c5bbc3c0-814b-4b61-a512-166735d2b35c + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 5E94BF15FB694815AC316D6C7B930C3D Ref B: MAA201060516019 Ref C: 2024-12-30T20:50:08Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_show_playwright_workspace.yaml b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_show_playwright_workspace.yaml new file mode 100644 index 00000000000..4360ee90b91 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_show_playwright_workspace.yaml @@ -0,0 +1,52 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace show + Connection: + - keep-alive + ParameterSetName: + - --resource-group --workspace-name + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4?api-version=2024-12-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4","name":"testingworkspaceap4","type":"microsoft.azureplaywrightservice/accounts","location":"eastus","systemData":{"createdBy":"shreyaanand@microsoft.com","createdByType":"User","createdAt":"2024-12-30T20:58:38.0223255Z","lastModifiedBy":"shreyaanand@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2024-12-30T20:58:38.0223255Z"},"properties":{"dashboardUri":"https://playwright.microsoft.com/workspaces/eastus_d63658af-3a0f-4958-a071-0d645c6f77ed","regionalAffinity":"Enabled","reporting":"Enabled","scalableExecution":"Enabled","provisioningState":"Succeeded","localAuth":"Disabled"}}' + headers: + cache-control: + - no-cache + content-length: + - '768' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 21:01:56 GMT + etag: + - '"a604de8c-0000-0100-0000-6773097f0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: CF6EC8C0066045C0AD55481C0D9CF971 Ref B: MAA201060516019 Ref C: 2024-12-30T21:01:56Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_update_playwright_workspace.yaml b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_update_playwright_workspace.yaml new file mode 100644 index 00000000000..bbc3058628d --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/recordings/test_update_playwright_workspace.yaml @@ -0,0 +1,226 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace update + Connection: + - keep-alive + ParameterSetName: + - --resource-group --workspace-name --regional-affinity + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4?api-version=2024-12-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4","name":"testingworkspaceap4","type":"microsoft.azureplaywrightservice/accounts","location":"eastus","systemData":{"createdBy":"shreyaanand@microsoft.com","createdByType":"User","createdAt":"2024-12-30T20:58:38.0223255Z","lastModifiedBy":"shreyaanand@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2024-12-30T20:58:38.0223255Z"},"properties":{"dashboardUri":"https://playwright.microsoft.com/workspaces/eastus_d63658af-3a0f-4958-a071-0d645c6f77ed","regionalAffinity":"Enabled","reporting":"Enabled","scalableExecution":"Enabled","provisioningState":"Succeeded","localAuth":"Disabled"}}' + headers: + cache-control: + - no-cache + content-length: + - '768' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 21:04:05 GMT + etag: + - '"a604de8c-0000-0100-0000-6773097f0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 271D8C64AD21436AB4662B44E9ED0850 Ref B: MAA201060516019 Ref C: 2024-12-30T21:04:04Z' + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus", "properties": {"localAuth": "Disabled", "regionalAffinity": + "Disabled", "reporting": "Enabled", "scalableExecution": "Enabled"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace update + Connection: + - keep-alive + Content-Length: + - '151' + Content-Type: + - application/json + ParameterSetName: + - --resource-group --workspace-name --regional-affinity + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4?api-version=2024-12-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4","name":"testingworkspaceap4","type":"microsoft.azureplaywrightservice/accounts","location":"eastus","systemData":{"createdBy":"shreyaanand@microsoft.com","createdByType":"User","createdAt":"2024-12-30T20:58:38.0223255Z","lastModifiedBy":"shreyaanand@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2024-12-30T21:04:05.528968Z"},"properties":{"dashboardUri":"https://playwright.microsoft.com/workspaces/eastus_d63658af-3a0f-4958-a071-0d645c6f77ed","regionalAffinity":"Disabled","reporting":"Enabled","scalableExecution":"Enabled","provisioningState":"Accepted","localAuth":"Disabled"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/EASTUS/operationStatuses/9e631893-153a-428a-ae9c-5aad2d351185*6F3B34C42603DBA956C442863A7C536BC86B9D4CBCA21A80C267D243D3F99E27?api-version=2024-12-01&t=638711894461070693&c=MIIHhzCCBm-gAwIBAgITfAWKSDa5exA4mgXQ1AAABYpINjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwE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AQELBQADggEBABmO88-7XRCIXOiojIRFVE6cNJ-T71-dYJW-Ued6MhWFUF1zSFvymU_uRv1_bEg_TyrZ750tgpd1H9PhKFlhiHwwz-j83cJmyKo0hYqzk6i5Zx_p5TXpgHTb7OpBsJ7P48Y4Ppsvzxd3QVtUd9ilvCEV-XQJ7fhkKZ13600A6um1pMWXYAAUwkzdm3un8uHXua6Nq-l2vM3z1ZTyjAgj7nvYa7o5ZNs_OcOy2wJMMdqFC889ZaT5MnwhxvMuCwk4oC2qeCYPhlozGGTQ2A2_2d9abDdl6nUk7gqcnJBKzXGM2vpZdzRFR2oN6Kpu1p_5pUtwpvTrpTef5ByUqFnYAY8&s=VUtqX13r4HtBYe-xtNymrOzeeI58ZQSo_wN7hNYbIXiClHawgZadUmKKcVr5UgqJ61GWeddN3dMdVBsnj22Uy_tFvGI7_U-439ORAYmHNDENR0eNXUa_3FfL1dApold2GcEmcSa6Kkqyg8TutltkFEetpDke5mLa5j745XVyFDYgisN3ddf1MHsStaRJHKUu46Fh9l7L4EHdoHgNnlFhGnQm04u9WVQtWqJDiTdkKKhMQhAMoDIi6g2Mwx9z9ULXfsnsMI9_UPS2yNP7seu_qkdCyhB8OVj0wAkyXUusnBtcI2GK2WhnGo8c-TQbxvoYOmCRsXqD9T-9AqgqT_Jwsw&h=albO2DJeTZnqJQkgVAPsXfDsVmLftGMvGFjYvRYpMPs + cache-control: + - no-cache + content-length: + - '767' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 21:04:06 GMT + etag: + - '"a60469ab-0000-0100-0000-67730ac50000"' + expires: + - '-1' + mise-correlation-id: + - 03ee6b61-f8ca-41cc-9cc1-b8aa4908a298 + pragma: + - no-cache + set-cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + Path=/; Secure; HttpOnly; + - ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + SameSite=none; Path=/; Secure; HttpOnly; + strict-transport-security: + - max-age=31536000; includeSubDomains + x-azure-ref: + - 20241230T210405Z-175dd4d5677snj9thC1MNZ8ems0000001mkg0000000004ge + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-correlation-id: + - d97c1f2c-2452-4530-b374-09e8f2cf8f10 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-writes: + - '11999' + x-ms-ratelimit-remaining-subscription-writes: + - '799' + x-msedge-ref: + - 'Ref A: 7CD1D91C4A1B4EB9AF22519778F53FAD Ref B: MAA201060516019 Ref C: 2024-12-30T21:04:05Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace update + Connection: + - keep-alive + Cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345 + ParameterSetName: + - --resource-group --workspace-name --regional-affinity + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/EASTUS/operationStatuses/9e631893-153a-428a-ae9c-5aad2d351185*6F3B34C42603DBA956C442863A7C536BC86B9D4CBCA21A80C267D243D3F99E27?api-version=2024-12-01&t=638711894461070693&c=MIIHhzCCBm-gAwIBAgITfAWKSDa5exA4mgXQ1AAABYpINjANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDUwHhcNMjQwOTI0MDE1ODQ4WhcNMjUwMzIzMDE1ODQ4WjBAMT4wPAYDVQQD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TXpgHTb7OpBsJ7P48Y4Ppsvzxd3QVtUd9ilvCEV-XQJ7fhkKZ13600A6um1pMWXYAAUwkzdm3un8uHXua6Nq-l2vM3z1ZTyjAgj7nvYa7o5ZNs_OcOy2wJMMdqFC889ZaT5MnwhxvMuCwk4oC2qeCYPhlozGGTQ2A2_2d9abDdl6nUk7gqcnJBKzXGM2vpZdzRFR2oN6Kpu1p_5pUtwpvTrpTef5ByUqFnYAY8&s=VUtqX13r4HtBYe-xtNymrOzeeI58ZQSo_wN7hNYbIXiClHawgZadUmKKcVr5UgqJ61GWeddN3dMdVBsnj22Uy_tFvGI7_U-439ORAYmHNDENR0eNXUa_3FfL1dApold2GcEmcSa6Kkqyg8TutltkFEetpDke5mLa5j745XVyFDYgisN3ddf1MHsStaRJHKUu46Fh9l7L4EHdoHgNnlFhGnQm04u9WVQtWqJDiTdkKKhMQhAMoDIi6g2Mwx9z9ULXfsnsMI9_UPS2yNP7seu_qkdCyhB8OVj0wAkyXUusnBtcI2GK2WhnGo8c-TQbxvoYOmCRsXqD9T-9AqgqT_Jwsw&h=albO2DJeTZnqJQkgVAPsXfDsVmLftGMvGFjYvRYpMPs + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/EASTUS/operationStatuses/9e631893-153a-428a-ae9c-5aad2d351185*6F3B34C42603DBA956C442863A7C536BC86B9D4CBCA21A80C267D243D3F99E27","name":"9e631893-153a-428a-ae9c-5aad2d351185*6F3B34C42603DBA956C442863A7C536BC86B9D4CBCA21A80C267D243D3F99E27","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4","status":"Succeeded","startTime":"2024-12-30T21:04:05.6644814Z","endTime":"2024-12-30T21:04:06.1784424Z","properties":null}' + headers: + cache-control: + - no-cache + content-length: + - '651' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 21:04:06 GMT + etag: + - '"f407e05f-0000-0100-0000-67730ac60000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 8EDEF34A46004AF5B81407F76690EB4C Ref B: MAA201060516019 Ref C: 2024-12-30T21:04:06Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - playwright-testing workspace update + Connection: + - keep-alive + Cookie: + - ASLBSA=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345; + ASLBSACORS=000326b7f69876b2a67c1b6edba7c94a1bde041cf2fab7c7fe44c5291a6ea96bf345 + ParameterSetName: + - --resource-group --workspace-name --regional-affinity + User-Agent: + - AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.12.8 (Linux-6.5.0-1025-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4?api-version=2024-12-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingworkspaceap2-rg/providers/Microsoft.AzurePlaywrightService/accounts/testingworkspaceap4","name":"testingworkspaceap4","type":"microsoft.azureplaywrightservice/accounts","location":"eastus","systemData":{"createdBy":"shreyaanand@microsoft.com","createdByType":"User","createdAt":"2024-12-30T20:58:38.0223255Z","lastModifiedBy":"shreyaanand@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2024-12-30T21:04:05.528968Z"},"properties":{"dashboardUri":"https://playwright.microsoft.com/workspaces/eastus_d63658af-3a0f-4958-a071-0d645c6f77ed","regionalAffinity":"Disabled","reporting":"Enabled","scalableExecution":"Enabled","provisioningState":"Succeeded","localAuth":"Disabled"}}' + headers: + cache-control: + - no-cache + content-length: + - '768' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 30 Dec 2024 21:04:07 GMT + etag: + - '"a6046bab-0000-0100-0000-67730ac60000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '16499' + x-msedge-ref: + - 'Ref A: 97C182CDEBD84C418145B602065FEBBB Ref B: MAA201060516019 Ref C: 2024-12-30T21:04:06Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/test_playwright_cli_extension.py b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/test_playwright_cli_extension.py new file mode 100644 index 00000000000..4799fb84142 --- /dev/null +++ b/src/playwright-cli-extension/azext_playwright_cli_extension/tests/latest/test_playwright_cli_extension.py @@ -0,0 +1,225 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, JMESPathCheck + +class PlaywrightCliExtensionScenario(ScenarioTest): + @ResourceGroupPreparer(name_prefix='test_rg', location='eastus') + def test_list_playwright_quota_by_subscription(self, resource_group): + self.kwargs.update({ + 'location': 'eastus' + }) + + # Execute the command to list quotas + result = self.cmd( + 'az playwright-testing quota list --location {location}', + checks=[ + JMESPathCheck("length(@)", 2, 'Expected exactly two quota entries in the list'), + JMESPathCheck('[0].name', 'ScalableExecution', 'Expected first quota name to be ScalableExecution'), + JMESPathCheck('[0].provisioningState', 'Succeeded', 'Expected provisioning state to be Succeeded'), + JMESPathCheck('[0].freeTrial.state', 'Expired', 'Expected free trial state to be Expired'), + JMESPathCheck('[1].name', 'Reporting', 'Expected second quota name to be Reporting'), # Additional check for the second item + JMESPathCheck('[1].provisioningState', 'Succeeded', 'Expected second provisioning state to be Succeeded'), + JMESPathCheck('[1].freeTrial.state', 'Expired', 'Expected second free trial state to be Expired') + ] + ).get_output_in_json() + + # Perform additional checks on the response + assert len(result) > 0, "Quota list should not be empty." + for item in result: + assert 'name' in item, "Each quota entry should have a name." + assert 'provisioningState' in item, "Each quota entry should have a provisioningState." + assert 'freeTrial' in item, "Each quota entry should include freeTrial information." + assert 'state' in item['freeTrial'], "Each freeTrial entry should have a state." + +class PlaywrightCliExtensionScenario(ScenarioTest): + @ResourceGroupPreparer(name_prefix='test_rg', location='eastus') + def test_show_playwright_quota_by_name(self, resource_group): + self.kwargs.update({ + 'location': 'eastus', + 'quota_name': 'ScalableExecution' + }) + + # Execute the command to show quota for a specific quota name + result = self.cmd( + 'az playwright-testing quota show --location {location} --quota-name {quota_name}', + checks=[ + JMESPathCheck('name', 'ScalableExecution', 'Expected quota name to be ScalableExecution'), + JMESPathCheck('provisioningState', 'Succeeded', 'Expected provisioning state to be Succeeded'), + JMESPathCheck('freeTrial.state', 'Expired', 'Expected free trial state to be Expired'), + JMESPathCheck('offeringType', 'NotApplicable', 'Expected offering type to be NotApplicable') + ] + ).get_output_in_json() + + # Perform additional checks on the response + assert result is not None, "Response should not be empty." + assert 'name' in result, "Quota should have a name." + assert 'provisioningState' in result, "Quota should have a provisioning state." + assert 'freeTrial' in result, "Quota should have freeTrial information." + assert 'state' in result['freeTrial'], "freeTrial should have a state." + assert 'offeringType' in result, "Quota should have an offeringType." + + +class PlaywrightCliExtensionScenario(ScenarioTest): + @ResourceGroupPreparer(name_prefix='test_rg', location='eastus') + def test_playwright_workspace_quota_not_found(self, resource_group): + self.kwargs.update({ + 'resource_group': 'testingworkspaceap2-rg', + 'workspace_name': 'testingworkspaceap2', + 'quota_name': 'ScalableExecution' + }) + + # Attempt to fetch a non-existent quota and validate the 404 response + self.cmd( + "az playwright-testing workspace quota show " + "--resource-group {resource_group} " + "--workspace-name {workspace_name} " + "--quota-name {quota_name}", + expect_failure=True + ) + +class PlaywrightCliExtensionScenario(ScenarioTest): + @ResourceGroupPreparer(name_prefix='test_rg', location='eastus') + def test_create_playwright_workspace(self, resource_group): + self.kwargs.update({ + 'location': 'eastus', + 'workspace_name': 'testingworkspaceap4', + 'resource_group': 'testingworkspaceap2-rg' + }) + + # Execute the command to create the workspace + result = self.cmd( + 'az playwright-testing workspace create --resource-group {resource_group} --workspace-name {workspace_name} --location {location}', + checks=[ + JMESPathCheck('name', 'testingworkspaceap4', 'Expected workspace name to be testingworkspaceap4'), + JMESPathCheck('provisioningState', 'Succeeded', 'Expected provisioning state to be Succeeded'), + JMESPathCheck('localAuth', 'Disabled', 'Expected localAuth to be Disabled'), + JMESPathCheck('location', 'eastus', 'Expected location to be eastus'), + JMESPathCheck('regionalAffinity', 'Enabled', 'Expected regionalAffinity to be Enabled'), + JMESPathCheck('reporting', 'Enabled', 'Expected reporting to be Enabled'), + JMESPathCheck('scalableExecution', 'Enabled', 'Expected scalableExecution to be Enabled') + ] + ).get_output_in_json() + + # Perform additional checks on the response + assert result is not None, "Response should not be empty." + assert 'name' in result, "Workspace should have a name." + assert 'provisioningState' in result, "Workspace should have a provisioning state." + assert 'localAuth' in result, "Workspace should have a localAuth field." + assert 'location' in result, "Workspace should have a location." + assert 'regionalAffinity' in result, "Workspace should have regionalAffinity." + assert 'reporting' in result, "Workspace should have reporting enabled." + assert 'scalableExecution' in result, "Workspace should have scalableExecution enabled." + +class PlaywrightCliExtensionScenario(ScenarioTest): + @ResourceGroupPreparer(name_prefix='test_rg', location='eastus') + def test_show_playwright_workspace(self, resource_group): + self.kwargs.update({ + 'location': 'eastus', + 'workspace_name': 'testingworkspaceap4', # Workspace name is 'testingworkspaceap4' + 'resource_group': 'testingworkspaceap2-rg' + }) + + # Execute the command to show the workspace details + result = self.cmd( + 'az playwright-testing workspace show --resource-group {resource_group} --workspace-name {workspace_name}', + checks=[ + JMESPathCheck('name', 'testingworkspaceap4', 'Expected workspace name to be testingworkspaceap4'), + JMESPathCheck('provisioningState', 'Succeeded', 'Expected provisioning state to be Succeeded'), + JMESPathCheck('localAuth', 'Disabled', 'Expected localAuth to be Disabled'), + JMESPathCheck('location', 'eastus', 'Expected location to be eastus'), + JMESPathCheck('regionalAffinity', 'Enabled', 'Expected regionalAffinity to be Enabled'), + JMESPathCheck('reporting', 'Enabled', 'Expected reporting to be Enabled'), + JMESPathCheck('scalableExecution', 'Enabled', 'Expected scalableExecution to be Enabled') + ] + ).get_output_in_json() + + # Perform additional checks on the response + assert result is not None, "Response should not be empty." + assert 'name' in result, "Workspace should have a name." + assert 'provisioningState' in result, "Workspace should have a provisioning state." + assert 'localAuth' in result, "Workspace should have a localAuth field." + assert 'location' in result, "Workspace should have a location." + assert 'regionalAffinity' in result, "Workspace should have regionalAffinity." + assert 'reporting' in result, "Workspace should have reporting enabled." + assert 'scalableExecution' in result, "Workspace should have scalableExecution enabled." + +class PlaywrightCliExtensionScenario(ScenarioTest): + @ResourceGroupPreparer(name_prefix='test_rg', location='eastus') + def test_update_playwright_workspace(self, resource_group): + self.kwargs.update({ + 'location': 'eastus', + 'workspace_name': 'testingworkspaceap4', + 'resource_group': 'testingworkspaceap2-rg' + }) + + # Execute the command to update the workspace with regional affinity disabled + result = self.cmd( + 'az playwright-testing workspace update --resource-group {resource_group} --workspace-name {workspace_name} --regional-affinity Disabled', + checks=[ + JMESPathCheck('name', 'testingworkspaceap4', 'Expected workspace name to be testingworkspaceap4'), + JMESPathCheck('provisioningState', 'Succeeded', 'Expected provisioning state to be Succeeded'), + JMESPathCheck('localAuth', 'Disabled', 'Expected localAuth to be Disabled'), + JMESPathCheck('location', 'eastus', 'Expected location to be eastus'), + JMESPathCheck('regionalAffinity', 'Disabled', 'Expected regionalAffinity to be Disabled'), + JMESPathCheck('reporting', 'Enabled', 'Expected reporting to be Enabled'), + JMESPathCheck('scalableExecution', 'Enabled', 'Expected scalableExecution to be Enabled') + ] + ).get_output_in_json() + + # Perform additional checks on the response + assert result is not None, "Response should not be empty." + assert 'name' in result, "Workspace should have a name." + assert 'provisioningState' in result, "Workspace should have a provisioning state." + assert 'localAuth' in result, "Workspace should have a localAuth field." + assert 'location' in result, "Workspace should have a location." + assert 'regionalAffinity' in result, "Workspace should have regionalAffinity." + assert 'reporting' in result, "Workspace should have reporting enabled." + assert 'scalableExecution' in result, "Workspace should have scalableExecution enabled." + +class PlaywrightCliExtensionScenario(ScenarioTest): + @ResourceGroupPreparer(name_prefix='test_rg', location='eastus') + def test_delete_playwright_workspace(self, resource_group): + self.kwargs.update({ + 'location': 'eastus', + 'workspace_name': 'testingworkspaceap4', + 'resource_group': 'testingworkspaceap2-rg' + }) + + # Execute the command to delete the workspace with the --yes flag to skip confirmation + result = self.cmd( + 'az playwright-testing workspace delete --resource-group {resource_group} --workspace-name {workspace_name} --yes', + checks=[] + ) + + # Since the delete command does not return output, we can check for the absence of errors + # Just ensure no exceptions are raised and the result doesn't contain unexpected output. + assert result is not None, "Delete command should not raise an exception." + +class PlaywrightCliExtensionScenario(ScenarioTest): + @ResourceGroupPreparer(name_prefix='test_rg', location='eastus') + def test_list_playwright_workspaces(self, resource_group): + self.kwargs.update({ + 'resource_group': 'testingworkspaceap2-rg' + }) + + # Execute the command to list workspaces in the specified resource group + result = self.cmd( + 'az playwright-testing workspace list --resource-group {resource_group}', + checks=[] + ).get_output_in_json() + + # Perform a check to ensure the result is not empty and has items + assert result is not None, "Response should not be empty." + assert isinstance(result, list), "Expected the result to be a list." + assert len(result) > 0, "Expected the list of workspaces to have more than 0 items." + + first_workspace = result[0] + assert 'name' in first_workspace, "Workspace should have a name." + assert 'location' in first_workspace, "Workspace should have a location." + assert 'provisioningState' in first_workspace, "Workspace should have a provisioning state." + assert 'regionalAffinity' in first_workspace, "Workspace should have regionalAffinity." \ No newline at end of file diff --git a/src/playwright-cli-extension/setup.cfg b/src/playwright-cli-extension/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/playwright-cli-extension/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/playwright-cli-extension/setup.py b/src/playwright-cli-extension/setup.py new file mode 100644 index 00000000000..949f9e591b7 --- /dev/null +++ b/src/playwright-cli-extension/setup.py @@ -0,0 +1,49 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + + +# HISTORY.rst entry. +VERSION = '1.0.0b1' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='playwright-cli-extension', + version=VERSION, + description='Microsoft Azure Command-Line Tools PlaywrightCliExtension Extension.', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/main/src/playwright-cli-extension', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_playwright_cli_extension': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) From ec02c0d9099aad1bd47b29eb4dd81430a3e0421c Mon Sep 17 00:00:00 2001 From: Shreya Anand Date: Thu, 9 Jan 2025 09:16:29 +0000 Subject: [PATCH 2/4] added service name changes --- src/service_name.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/service_name.json b/src/service_name.json index 9d89ff5add9..84cd7d3fb01 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -943,5 +943,10 @@ "Command": "az mcc", "AzureServiceName": "Microsoft Connected Cache", "URL": "" + }, + { + "Command": "az playwright-testing", + "AzureServiceName": "Playwright Testing", + "URL": "https://learn.microsoft.com/en-us/azure/playwright-testing/" } ] From d2d95628b826bbbc82cc7a313209e2e66248823b Mon Sep 17 00:00:00 2001 From: Shreya Anand Date: Thu, 9 Jan 2025 10:10:13 +0000 Subject: [PATCH 3/4] updated readme --- src/playwright-cli-extension/README.md | 135 ++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 2 deletions(-) diff --git a/src/playwright-cli-extension/README.md b/src/playwright-cli-extension/README.md index df39a38038d..7eeae9945d4 100644 --- a/src/playwright-cli-extension/README.md +++ b/src/playwright-cli-extension/README.md @@ -1,5 +1,136 @@ # Azure CLI PlaywrightCliExtension Extension # -This is an extension to Azure CLI to manage PlaywrightCliExtension resources. +This is an extension to Azure CLI to create and manage Playwright Testing resources. ## How to use ## -Please add commands usage here. \ No newline at end of file + +### Create Azure Playwright Testing resource ### + +``` +az playwright-testing workspace create \ + --resource-group SampleRG \ + --workspace-name myPlaywrightWorkspace \ + --location westus \ + --regional-affinity Enabled +``` + +``` +az playwright-testing workspace create \ + -g SampleRG \ + -n myPlaywrightWorkspace \ + -l westus \ + --regional-affinity Enabled +``` + +``` +az playwright-testing workspace create \ + -g SampleRG \ + -n myPlaywrightWorkspace \ + -l westus \ + --local-auth Enabled +``` +--- +
+ +### Update Azure Playwright Testing resource ### + +``` +az playwright-testing workspace update \ + --resource-group SampleRG \ + --workspace-name myPlaywrightWorkspace \ + --regional-affinity Disabled +``` + +``` +az playwright-testing workspace update \ + --resource-group SampleRG \ + --workspace-name myPlaywrightWorkspace \ + --reporting Disabled +``` +--- +
+ +### List Azure Playwright Testing resource ### + +``` +az playwright-testing workspace list \ + --resource-group sample-rg +``` + +``` +az playwright-testing workspace list +``` +--- +
+ +### Show Azure Playwright Testing resource ### + +``` +az playwright-testing workspace show \ + --resource-group SampleRG \ + --workspace-name myPlaywrightWorkspace +``` +--- +
+ +### Delete Azure Playwright Testing resource ### + +``` +az playwright-testing workspace delete \ + --resource-group SampleRG \ + --workspace-name myPlaywrightWorkspace +``` +--- +
+ +### List Azure Playwright Testing resource quota ### + +``` +az playwright-testing workspace quota list \ + --resource-group SampleRG \ + --workspace-name myPlaywrightWorkspace +``` +--- +
+ +### Show Azure Playwright Testing resource quota ### + +``` +az playwright-testing workspace quota show \ + --resource-group SampleRG \ + --workspace-name myPlaywrightWorkspace \ + --quota-name ScalableExecution +``` + +``` +az playwright-testing workspace quota show \ + --resource-group SampleRG \ + --workspace-name myPlaywrightWorkspace \ + --quota-name Reporting +``` +--- +
+ +### List Azure Playwright Testing quota ### + +``` +az playwright-testing quota list \ + --location eastus +``` +--- +
+ +### Show Azure Playwright Testing quota ### + +``` +az playwright-testing quota show \ + --location eastus \ + --quota-name ScalableExecution +``` + +``` +az playwright-testing quota show \ + --location eastus \ + --quota-name Reporting +``` +--- +
\ No newline at end of file From b2d389829a99005473fec8ebd200a53f03272f2d Mon Sep 17 00:00:00 2001 From: Shreya Anand Date: Thu, 9 Jan 2025 10:20:14 +0000 Subject: [PATCH 4/4] updated readme --- src/playwright-cli-extension/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/playwright-cli-extension/README.md b/src/playwright-cli-extension/README.md index 7eeae9945d4..c6b87b302c1 100644 --- a/src/playwright-cli-extension/README.md +++ b/src/playwright-cli-extension/README.md @@ -3,6 +3,11 @@ This is an extension to Azure CLI to create and manage Playwright Testing resour ## How to use ## +Install this extension using the below CLI command +``` +az extension add --name playwright-cli-extension +``` + ### Create Azure Playwright Testing resource ### ```