Skip to content

Commit 5e80482

Browse files
committed
playwright testing cli entension added
1 parent afcd1f3 commit 5e80482

Some content is hidden

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

42 files changed

+4241
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. :changelog:
2+
3+
Release History
4+
===============
5+
6+
1.0.0b1
7+
++++++
8+
* Initial release.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Azure CLI PlaywrightCliExtension Extension #
2+
This is an extension to Azure CLI to manage PlaywrightCliExtension resources.
3+
4+
## How to use ##
5+
Please add commands usage here.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
from azure.cli.core import AzCommandsLoader
9+
from azext_playwright_cli_extension._help import helps # pylint: disable=unused-import
10+
11+
12+
class PlaywrightCliExtensionCommandsLoader(AzCommandsLoader):
13+
14+
def __init__(self, cli_ctx=None):
15+
from azure.cli.core.commands import CliCommandType
16+
custom_command_type = CliCommandType(
17+
operations_tmpl='azext_playwright_cli_extension.custom#{}')
18+
super().__init__(cli_ctx=cli_ctx,
19+
custom_command_type=custom_command_type)
20+
21+
def load_command_table(self, args):
22+
from azext_playwright_cli_extension.commands import load_command_table
23+
from azure.cli.core.aaz import load_aaz_command_table
24+
try:
25+
from . import aaz
26+
except ImportError:
27+
aaz = None
28+
if aaz:
29+
load_aaz_command_table(
30+
loader=self,
31+
aaz_pkg_name=aaz.__name__,
32+
args=args
33+
)
34+
load_command_table(self, args)
35+
return self.command_table
36+
37+
def load_arguments(self, command):
38+
from azext_playwright_cli_extension._params import load_arguments
39+
load_arguments(self, command)
40+
41+
42+
COMMAND_LOADER_CLS = PlaywrightCliExtensionCommandsLoader
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=line-too-long
9+
# pylint: disable=too-many-lines
10+
11+
from knack.help_files import helps # pylint: disable=unused-import
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=too-many-lines
9+
# pylint: disable=too-many-statements
10+
11+
12+
def load_arguments(self, _): # pylint: disable=unused-argument
13+
pass
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"playwright-testing",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Microsoft Playwright Testing service
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._check_name_availability import *
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command(
15+
"playwright-testing check-name-availability",
16+
)
17+
class CheckNameAvailability(AAZCommand):
18+
"""Adds check global name availability operation, normally used if a resource name must be globally unique.
19+
"""
20+
21+
_aaz_info = {
22+
"version": "2024-12-01",
23+
"resources": [
24+
["mgmt-plane", "/subscriptions/{}/providers/microsoft.azureplaywrightservice/checknameavailability", "2024-12-01"],
25+
]
26+
}
27+
28+
def _handler(self, command_args):
29+
super()._handler(command_args)
30+
self._execute_operations()
31+
return self._output()
32+
33+
_args_schema = None
34+
35+
@classmethod
36+
def _build_arguments_schema(cls, *args, **kwargs):
37+
if cls._args_schema is not None:
38+
return cls._args_schema
39+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
40+
41+
# define Arg Group ""
42+
43+
# define Arg Group "Body"
44+
45+
_args_schema = cls._args_schema
46+
_args_schema.name = AAZStrArg(
47+
options=["--name"],
48+
arg_group="Body",
49+
help="The name of the resource for which availability needs to be checked.",
50+
)
51+
_args_schema.type = AAZStrArg(
52+
options=["--type"],
53+
arg_group="Body",
54+
help="The resource type.",
55+
)
56+
return cls._args_schema
57+
58+
def _execute_operations(self):
59+
self.pre_operations()
60+
self.AccountsCheckNameAvailability(ctx=self.ctx)()
61+
self.post_operations()
62+
63+
@register_callback
64+
def pre_operations(self):
65+
pass
66+
67+
@register_callback
68+
def post_operations(self):
69+
pass
70+
71+
def _output(self, *args, **kwargs):
72+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
73+
return result
74+
75+
class AccountsCheckNameAvailability(AAZHttpOperation):
76+
CLIENT_TYPE = "MgmtClient"
77+
78+
def __call__(self, *args, **kwargs):
79+
request = self.make_request()
80+
session = self.client.send_request(request=request, stream=False, **kwargs)
81+
if session.http_response.status_code in [200]:
82+
return self.on_200(session)
83+
84+
return self.on_error(session.http_response)
85+
86+
@property
87+
def url(self):
88+
return self.client.format_url(
89+
"/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability",
90+
**self.url_parameters
91+
)
92+
93+
@property
94+
def method(self):
95+
return "POST"
96+
97+
@property
98+
def error_format(self):
99+
return "MgmtErrorFormat"
100+
101+
@property
102+
def url_parameters(self):
103+
parameters = {
104+
**self.serialize_url_param(
105+
"subscriptionId", self.ctx.subscription_id,
106+
required=True,
107+
),
108+
}
109+
return parameters
110+
111+
@property
112+
def query_parameters(self):
113+
parameters = {
114+
**self.serialize_query_param(
115+
"api-version", "2024-12-01",
116+
required=True,
117+
),
118+
}
119+
return parameters
120+
121+
@property
122+
def header_parameters(self):
123+
parameters = {
124+
**self.serialize_header_param(
125+
"Content-Type", "application/json",
126+
),
127+
**self.serialize_header_param(
128+
"Accept", "application/json",
129+
),
130+
}
131+
return parameters
132+
133+
@property
134+
def content(self):
135+
_content_value, _builder = self.new_content_builder(
136+
self.ctx.args,
137+
typ=AAZObjectType,
138+
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
139+
)
140+
_builder.set_prop("name", AAZStrType, ".name")
141+
_builder.set_prop("type", AAZStrType, ".type")
142+
143+
return self.serialize_content(_content_value)
144+
145+
def on_200(self, session):
146+
data = self.deserialize_http_content(session)
147+
self.ctx.set_var(
148+
"instance",
149+
data,
150+
schema_builder=self._build_schema_on_200
151+
)
152+
153+
_schema_on_200 = None
154+
155+
@classmethod
156+
def _build_schema_on_200(cls):
157+
if cls._schema_on_200 is not None:
158+
return cls._schema_on_200
159+
160+
cls._schema_on_200 = AAZObjectType()
161+
162+
_schema_on_200 = cls._schema_on_200
163+
_schema_on_200.message = AAZStrType()
164+
_schema_on_200.name_available = AAZBoolType(
165+
serialized_name="nameAvailable",
166+
)
167+
_schema_on_200.reason = AAZStrType()
168+
169+
return cls._schema_on_200
170+
171+
172+
class _CheckNameAvailabilityHelper:
173+
"""Helper class for CheckNameAvailability"""
174+
175+
176+
__all__ = ["CheckNameAvailability"]

0 commit comments

Comments
 (0)