diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/README.md b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/README.md index 7ebd4b20f879..f9c79c0cf78a 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/README.md +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Playwrighttesting Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json index 9f176a81256b..5e589dd7ce37 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json @@ -1,6 +1,6 @@ { - "commit": "58740206b853320974ef5e4864f7be8120b15a27", + "commit": "079f70d6f2b754db6b736e117196104efd2dd496", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/playwrighttesting/PlaywrightTesting.Management", - "@azure-tools/typespec-python": "0.37.1" + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/apiview-properties.json b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/apiview-properties.json new file mode 100644 index 000000000000..5f8b4cfd0465 --- /dev/null +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/apiview-properties.json @@ -0,0 +1,59 @@ +{ + "CrossLanguagePackageId": "Microsoft.AzurePlaywrightService", + "CrossLanguageDefinitionId": { + "azure.mgmt.playwrighttesting.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.playwrighttesting.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.playwrighttesting.models.Account": "Microsoft.AzurePlaywrightService.Account", + "azure.mgmt.playwrighttesting.models.AccountFreeTrialProperties": "Microsoft.AzurePlaywrightService.AccountFreeTrialProperties", + "azure.mgmt.playwrighttesting.models.AccountProperties": "Microsoft.AzurePlaywrightService.AccountProperties", + "azure.mgmt.playwrighttesting.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.playwrighttesting.models.AccountQuota": "Microsoft.AzurePlaywrightService.AccountQuota", + "azure.mgmt.playwrighttesting.models.AccountQuotaProperties": "Microsoft.AzurePlaywrightService.AccountQuotaProperties", + "azure.mgmt.playwrighttesting.models.AccountUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.playwrighttesting.models.AccountUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.playwrighttesting.models.CheckNameAvailabilityRequest": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest", + "azure.mgmt.playwrighttesting.models.CheckNameAvailabilityResponse": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse", + "azure.mgmt.playwrighttesting.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.playwrighttesting.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.playwrighttesting.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.playwrighttesting.models.FreeTrialProperties": "Microsoft.AzurePlaywrightService.FreeTrialProperties", + "azure.mgmt.playwrighttesting.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.playwrighttesting.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.playwrighttesting.models.Quota": "Microsoft.AzurePlaywrightService.Quota", + "azure.mgmt.playwrighttesting.models.QuotaProperties": "Microsoft.AzurePlaywrightService.QuotaProperties", + "azure.mgmt.playwrighttesting.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.playwrighttesting.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.playwrighttesting.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.playwrighttesting.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.playwrighttesting.models.EnablementStatus": "Microsoft.AzurePlaywrightService.EnablementStatus", + "azure.mgmt.playwrighttesting.models.ProvisioningState": "Microsoft.AzurePlaywrightService.ProvisioningState", + "azure.mgmt.playwrighttesting.models.CheckNameAvailabilityReason": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason", + "azure.mgmt.playwrighttesting.models.FreeTrialState": "Microsoft.AzurePlaywrightService.FreeTrialState", + "azure.mgmt.playwrighttesting.models.OfferingType": "Microsoft.AzurePlaywrightService.OfferingType", + "azure.mgmt.playwrighttesting.models.QuotaNames": "Microsoft.AzurePlaywrightService.QuotaNames", + "azure.mgmt.playwrighttesting.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.playwrighttesting.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.playwrighttesting.operations.AccountsOperations.get": "Azure.ResourceManager.Accounts.get", + "azure.mgmt.playwrighttesting.aio.operations.AccountsOperations.get": "Azure.ResourceManager.Accounts.get", + "azure.mgmt.playwrighttesting.operations.AccountsOperations.begin_create_or_update": "Microsoft.AzurePlaywrightService.Accounts.createOrUpdate", + "azure.mgmt.playwrighttesting.aio.operations.AccountsOperations.begin_create_or_update": "Microsoft.AzurePlaywrightService.Accounts.createOrUpdate", + "azure.mgmt.playwrighttesting.operations.AccountsOperations.update": "Microsoft.AzurePlaywrightService.Accounts.update", + "azure.mgmt.playwrighttesting.aio.operations.AccountsOperations.update": "Microsoft.AzurePlaywrightService.Accounts.update", + "azure.mgmt.playwrighttesting.operations.AccountsOperations.begin_delete": "Microsoft.AzurePlaywrightService.Accounts.delete", + "azure.mgmt.playwrighttesting.aio.operations.AccountsOperations.begin_delete": "Microsoft.AzurePlaywrightService.Accounts.delete", + "azure.mgmt.playwrighttesting.operations.AccountsOperations.list_by_resource_group": "Azure.ResourceManager.Accounts.listByResourceGroup", + "azure.mgmt.playwrighttesting.aio.operations.AccountsOperations.list_by_resource_group": "Azure.ResourceManager.Accounts.listByResourceGroup", + "azure.mgmt.playwrighttesting.operations.AccountsOperations.list_by_subscription": "Azure.ResourceManager.Accounts.listBySubscription", + "azure.mgmt.playwrighttesting.aio.operations.AccountsOperations.list_by_subscription": "Azure.ResourceManager.Accounts.listBySubscription", + "azure.mgmt.playwrighttesting.operations.AccountsOperations.check_name_availability": "Microsoft.AzurePlaywrightService.Accounts.checkNameAvailability", + "azure.mgmt.playwrighttesting.aio.operations.AccountsOperations.check_name_availability": "Microsoft.AzurePlaywrightService.Accounts.checkNameAvailability", + "azure.mgmt.playwrighttesting.operations.QuotasOperations.get": "Microsoft.AzurePlaywrightService.Quotas.get", + "azure.mgmt.playwrighttesting.aio.operations.QuotasOperations.get": "Microsoft.AzurePlaywrightService.Quotas.get", + "azure.mgmt.playwrighttesting.operations.QuotasOperations.list_by_subscription": "Microsoft.AzurePlaywrightService.Quotas.listBySubscription", + "azure.mgmt.playwrighttesting.aio.operations.QuotasOperations.list_by_subscription": "Microsoft.AzurePlaywrightService.Quotas.listBySubscription", + "azure.mgmt.playwrighttesting.operations.AccountQuotasOperations.get": "Microsoft.AzurePlaywrightService.AccountQuotas.get", + "azure.mgmt.playwrighttesting.aio.operations.AccountQuotasOperations.get": "Microsoft.AzurePlaywrightService.AccountQuotas.get", + "azure.mgmt.playwrighttesting.operations.AccountQuotasOperations.list_by_account": "Microsoft.AzurePlaywrightService.AccountQuotas.listByAccount", + "azure.mgmt.playwrighttesting.aio.operations.AccountQuotasOperations.list_by_account": "Microsoft.AzurePlaywrightService.AccountQuotas.listByAccount" + } +} \ No newline at end of file diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_client.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_client.py index b536909c796a..e37b49b9440c 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_client.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_client.py @@ -7,16 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from ._configuration import PlaywrightTestingMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import AccountQuotasOperations, AccountsOperations, Operations, QuotasOperations if TYPE_CHECKING: @@ -38,7 +40,7 @@ class PlaywrightTestingMgmtClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service host. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str :keyword api_version: The API version to use for this operation. Default value is "2024-12-01". Note that overriding this default value may result in unsupported behavior. @@ -48,16 +50,22 @@ class PlaywrightTestingMgmtClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = PlaywrightTestingMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -76,7 +84,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_patch.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_patch.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/__init__.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/__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 Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_model_base.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/model_base.py similarity index 94% rename from sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_model_base.py rename to sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/model_base.py index 7f73b97b23ef..49d5c7259389 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_model_base.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/model_base.py @@ -2,8 +2,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=protected-access, broad-except @@ -21,6 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -28,11 +30,6 @@ from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping - _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -347,7 +344,7 @@ def _get_model(module_name: str, model_name: str): _UNSET = object() -class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object +class _MyMutableMapping(MutableMapping[str, typing.Any]): def __init__(self, data: typing.Dict[str, typing.Any]) -> None: self._data = data @@ -373,50 +370,97 @@ def __ne__(self, other: typing.Any) -> bool: return not self.__eq__(other) def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ return self._data.items() def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ try: return self[key] except KeyError: return default @typing.overload - def pop(self, key: str) -> typing.Any: ... + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ @typing.overload - def pop(self, key: str, default: _T) -> _T: ... + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ if default is _UNSET: return self._data.pop(key) return self._data.pop(key, default) def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ return self._data.popitem() def clear(self) -> None: + """ + Remove all items from D. + """ self._data.clear() - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ self._data.update(*args, **kwargs) @typing.overload def setdefault(self, key: str, default: None = None) -> None: ... @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ if default is _UNSET: return self._data.setdefault(key) return self._data.setdefault(key, default) @@ -597,7 +641,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: @@ -633,7 +677,7 @@ def _deserialize(cls, data, exist_discriminators): discriminator_value = data.find(xml_name).text # pyright: ignore else: discriminator_value = data.get(discriminator._rest_name) - mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member return mapped_cls._deserialize(data, exist_discriminators) def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: @@ -910,6 +954,19 @@ def _failsafe_deserialize( return None +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + class _RestField: def __init__( self, diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_serialization.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/serialization.py similarity index 94% rename from sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_serialization.py rename to sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/serialization.py index b24ab2885450..eb86ea23c965 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_serialization.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_utils/serialization.py @@ -1,28 +1,10 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -48,9 +30,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +165,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -479,8 +393,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -626,7 +540,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +650,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +695,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +719,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +749,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +769,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1106,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1132,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1165,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1343,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1488,7 +1402,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1416,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1717,7 +1631,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1799,7 +1713,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1845,7 +1759,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1936,7 +1850,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1949,7 +1863,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1964,7 +1878,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1982,7 +1896,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1995,7 +1909,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2013,7 +1927,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2029,7 +1943,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2044,14 +1958,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2067,7 +1981,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2105,7 +2019,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_version.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_version.py index 0ec13ea52bbf..be71c81bd282 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_version.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_client.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_client.py index b3e863150652..32a75341d846 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_client.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_client.py @@ -7,15 +7,17 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import PlaywrightTestingMgmtClientConfiguration from .operations import AccountQuotasOperations, AccountsOperations, Operations, QuotasOperations @@ -38,7 +40,7 @@ class PlaywrightTestingMgmtClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service host. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str :keyword api_version: The API version to use for this operation. Default value is "2024-12-01". Note that overriding this default value may result in unsupported behavior. @@ -48,16 +50,22 @@ class PlaywrightTestingMgmtClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = PlaywrightTestingMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -76,7 +84,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_patch.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_patch.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_operations.py index 06bc8d6e1f7e..a66cdc62b532 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_operations.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_operations.py @@ -6,12 +6,13 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase import json -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,7 +34,8 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import ( build_account_quotas_get_request, build_account_quotas_list_by_account_request, @@ -48,14 +50,11 @@ build_quotas_get_request, build_quotas_list_by_subscription_request, ) +from .._configuration import PlaywrightTestingMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -70,10 +69,12 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlaywrightTestingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -135,7 +136,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -171,10 +172,12 @@ class AccountsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlaywrightTestingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: @@ -814,7 +817,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Account], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Account], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -898,7 +901,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Account], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Account], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1065,10 +1068,12 @@ class QuotasOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlaywrightTestingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, location: str, quota_name: Union[str, _models.QuotaNames], **kwargs: Any) -> _models.Quota: @@ -1202,7 +1207,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Quota], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Quota], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1238,10 +1243,12 @@ class AccountQuotasOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlaywrightTestingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -1386,7 +1393,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AccountQuota], deserialized["value"]) + list_of_elem = _deserialize(List[_models.AccountQuota], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_patch.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_patch.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_models.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_models.py index 60a82c26e314..da705f99d6be 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_models.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_models.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,20 +11,17 @@ import datetime from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload -from .. import _model_base -from .._model_base import rest_field +from .._utils.model_base import Model as _Model, rest_field if TYPE_CHECKING: from .. import models as _models -class Resource(_model_base.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class Resource(_Model): + """Resource. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -37,7 +35,7 @@ class Resource(_model_base.Model): id: Optional[str] = rest_field(visibility=["read"]) """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" name: Optional[str] = rest_field(visibility=["read"]) """The name of the resource.""" type: Optional[str] = rest_field(visibility=["read"]) @@ -48,14 +46,10 @@ class Resource(_model_base.Model): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - + """Tracked Resource. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -71,7 +65,7 @@ class TrackedResource(Resource): :vartype location: str """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" location: str = rest_field(visibility=["read", "create"]) """The geo-location where the resource lives. Required.""" @@ -98,11 +92,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class Account(TrackedResource): """A Playwright service account resource. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -120,7 +111,9 @@ class Account(TrackedResource): :vartype properties: ~azure.mgmt.playwrighttesting.models.AccountProperties """ - properties: Optional["_models.AccountProperties"] = rest_field() + properties: Optional["_models.AccountProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -143,12 +136,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AccountFreeTrialProperties(_model_base.Model): +class AccountFreeTrialProperties(_Model): """The Playwright service account quota resource free-trial properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_at: The free-trial createdAt utcDateTime. Required. :vartype created_at: ~datetime.datetime :ivar expiry_at: The free-trial expiryAt utcDateTime. Required. @@ -174,11 +164,9 @@ class AccountFreeTrialProperties(_model_base.Model): """The free-trial percentage used. Required.""" -class AccountProperties(_model_base.Model): +class AccountProperties(_Model): """Account resource properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar dashboard_uri: The Playwright testing dashboard URI for the account resource. :vartype dashboard_uri: str :ivar regional_affinity: This property sets the connection region for Playwright client workers @@ -194,8 +182,8 @@ class AccountProperties(_model_base.Model): results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. Known values are: "Enabled" and "Disabled". :vartype reporting: str or ~azure.mgmt.playwrighttesting.models.EnablementStatus - :ivar local_auth: When enabled, this feature allows the workspace to use local auth(through - access key) for authentication of test runs. Known values are: "Enabled" and "Disabled". + :ivar local_auth: When enabled, this feature allows the workspace to use local auth (through + service access token) for executing operations. Known values are: "Enabled" and "Disabled". :vartype local_auth: str or ~azure.mgmt.playwrighttesting.models.EnablementStatus :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", and "Accepted". @@ -204,22 +192,30 @@ class AccountProperties(_model_base.Model): dashboard_uri: Optional[str] = rest_field(name="dashboardUri", visibility=["read"]) """The Playwright testing dashboard URI for the account resource.""" - regional_affinity: Optional[Union[str, "_models.EnablementStatus"]] = rest_field(name="regionalAffinity") + regional_affinity: Optional[Union[str, "_models.EnablementStatus"]] = rest_field( + name="regionalAffinity", visibility=["read", "create", "update", "delete", "query"] + ) """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. Known values are: \"Enabled\" and \"Disabled\".""" - scalable_execution: Optional[Union[str, "_models.EnablementStatus"]] = rest_field(name="scalableExecution") + scalable_execution: Optional[Union[str, "_models.EnablementStatus"]] = rest_field( + name="scalableExecution", visibility=["read", "create", "update", "delete", "query"] + ) """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. Known values are: \"Enabled\" and \"Disabled\".""" - reporting: Optional[Union[str, "_models.EnablementStatus"]] = rest_field() + reporting: Optional[Union[str, "_models.EnablementStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """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. Known values are: \"Enabled\" and \"Disabled\".""" - local_auth: Optional[Union[str, "_models.EnablementStatus"]] = rest_field(name="localAuth") - """When enabled, this feature allows the workspace to use local auth(through access key) for - authentication of test runs. Known values are: \"Enabled\" and \"Disabled\".""" + local_auth: Optional[Union[str, "_models.EnablementStatus"]] = rest_field( + name="localAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """When enabled, this feature allows the workspace to use local auth (through service access + token) for executing operations. Known values are: \"Enabled\" and \"Disabled\".""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] ) @@ -248,13 +244,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Readonly variables are only populated by the server, and will be ignored when sending a request. + """Proxy Resource. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -270,10 +263,8 @@ class ProxyResource(Resource): class AccountQuota(ProxyResource): """A quota resource for a Playwright service account. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -287,7 +278,9 @@ class AccountQuota(ProxyResource): :vartype properties: ~azure.mgmt.playwrighttesting.models.AccountQuotaProperties """ - properties: Optional["_models.AccountQuotaProperties"] = rest_field() + properties: Optional["_models.AccountQuotaProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -308,11 +301,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AccountQuotaProperties(_model_base.Model): +class AccountQuotaProperties(_Model): """The Playwright service account quota resource properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar free_trial: The Playwright service account quota resource free-trial properties. :vartype free_trial: ~azure.mgmt.playwrighttesting.models.AccountFreeTrialProperties :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", @@ -320,7 +311,9 @@ class AccountQuotaProperties(_model_base.Model): :vartype provisioning_state: str or ~azure.mgmt.playwrighttesting.models.ProvisioningState """ - free_trial: Optional["_models.AccountFreeTrialProperties"] = rest_field(name="freeTrial") + free_trial: Optional["_models.AccountFreeTrialProperties"] = rest_field( + name="freeTrial", visibility=["read", "create", "update", "delete", "query"] + ) """The Playwright service account quota resource free-trial properties.""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] @@ -346,7 +339,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AccountUpdate(_model_base.Model): +class AccountUpdate(_Model): """The type used for update operations of the Account. :ivar tags: Resource tags. @@ -355,9 +348,11 @@ class AccountUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.playwrighttesting.models.AccountUpdateProperties """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" - properties: Optional["_models.AccountUpdateProperties"] = rest_field() + properties: Optional["_models.AccountUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -379,7 +374,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AccountUpdateProperties(_model_base.Model): +class AccountUpdateProperties(_Model): """The updatable properties of the Account. :ivar regional_affinity: This property sets the connection region for Playwright client workers @@ -395,27 +390,35 @@ class AccountUpdateProperties(_model_base.Model): results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. Known values are: "Enabled" and "Disabled". :vartype reporting: str or ~azure.mgmt.playwrighttesting.models.EnablementStatus - :ivar local_auth: When enabled, this feature allows the workspace to use local auth(through - access key) for authentication of test runs. Known values are: "Enabled" and "Disabled". + :ivar local_auth: When enabled, this feature allows the workspace to use local auth (through + service access token) for executing operations. Known values are: "Enabled" and "Disabled". :vartype local_auth: str or ~azure.mgmt.playwrighttesting.models.EnablementStatus """ - regional_affinity: Optional[Union[str, "_models.EnablementStatus"]] = rest_field(name="regionalAffinity") + regional_affinity: Optional[Union[str, "_models.EnablementStatus"]] = rest_field( + name="regionalAffinity", visibility=["read", "create", "update", "delete", "query"] + ) """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. Known values are: \"Enabled\" and \"Disabled\".""" - scalable_execution: Optional[Union[str, "_models.EnablementStatus"]] = rest_field(name="scalableExecution") + scalable_execution: Optional[Union[str, "_models.EnablementStatus"]] = rest_field( + name="scalableExecution", visibility=["read", "create", "update", "delete", "query"] + ) """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. Known values are: \"Enabled\" and \"Disabled\".""" - reporting: Optional[Union[str, "_models.EnablementStatus"]] = rest_field() + reporting: Optional[Union[str, "_models.EnablementStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """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. Known values are: \"Enabled\" and \"Disabled\".""" - local_auth: Optional[Union[str, "_models.EnablementStatus"]] = rest_field(name="localAuth") - """When enabled, this feature allows the workspace to use local auth(through access key) for - authentication of test runs. Known values are: \"Enabled\" and \"Disabled\".""" + local_auth: Optional[Union[str, "_models.EnablementStatus"]] = rest_field( + name="localAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """When enabled, this feature allows the workspace to use local auth (through service access + token) for executing operations. Known values are: \"Enabled\" and \"Disabled\".""" @overload def __init__( @@ -438,7 +441,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CheckNameAvailabilityRequest(_model_base.Model): +class CheckNameAvailabilityRequest(_Model): """The check availability request body. :ivar name: The name of the resource for which availability needs to be checked. @@ -447,9 +450,9 @@ class CheckNameAvailabilityRequest(_model_base.Model): :vartype type: str """ - name: Optional[str] = rest_field() + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the resource for which availability needs to be checked.""" - type: Optional[str] = rest_field() + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resource type.""" @overload @@ -471,7 +474,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CheckNameAvailabilityResponse(_model_base.Model): +class CheckNameAvailabilityResponse(_Model): """The check availability result. :ivar name_available: Indicates if the resource name is available. @@ -483,12 +486,16 @@ class CheckNameAvailabilityResponse(_model_base.Model): :vartype message: str """ - name_available: Optional[bool] = rest_field(name="nameAvailable") + name_available: Optional[bool] = rest_field( + name="nameAvailable", visibility=["read", "create", "update", "delete", "query"] + ) """Indicates if the resource name is available.""" - reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = rest_field() + reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The reason why the given name is not available. Known values are: \"Invalid\" and \"AlreadyExists\".""" - message: Optional[str] = rest_field() + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Detailed reason why the given name is not available.""" @overload @@ -511,11 +518,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ErrorAdditionalInfo(_model_base.Model): +class ErrorAdditionalInfo(_Model): """The resource management error additional info. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. @@ -528,11 +533,9 @@ class ErrorAdditionalInfo(_model_base.Model): """The additional info.""" -class ErrorDetail(_model_base.Model): +class ErrorDetail(_Model): """The error detail. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar code: The error code. :vartype code: str :ivar message: The error message. @@ -559,15 +562,14 @@ class ErrorDetail(_model_base.Model): """The error additional info.""" -class ErrorResponse(_model_base.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. +class ErrorResponse(_Model): + """Error response. :ivar error: The error object. :vartype error: ~azure.mgmt.playwrighttesting.models.ErrorDetail """ - error: Optional["_models.ErrorDetail"] = rest_field() + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The error object.""" @overload @@ -588,12 +590,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FreeTrialProperties(_model_base.Model): +class FreeTrialProperties(_Model): """The subscription quota resource free-trial properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_id: The Playwright service account id. Required. :vartype account_id: str :ivar state: The free-trial state. Required. Known values are: "Active", "Expired", @@ -608,10 +607,8 @@ class FreeTrialProperties(_model_base.Model): \"NotRegistered\".""" -class Operation(_model_base.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class Operation(_Model): + """REST API Operation. :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". @@ -637,7 +634,9 @@ class Operation(_model_base.Model): is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for Azure Resource Manager/control-plane operations.""" - display: Optional["_models.OperationDisplay"] = rest_field() + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Localized display information for this particular operation.""" origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit @@ -665,11 +664,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OperationDisplay(_model_base.Model): +class OperationDisplay(_Model): """Localized display information for and operation. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". :vartype provider: str @@ -701,10 +698,8 @@ class OperationDisplay(_model_base.Model): class Quota(ProxyResource): """A subscription quota resource. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -718,7 +713,9 @@ class Quota(ProxyResource): :vartype properties: ~azure.mgmt.playwrighttesting.models.QuotaProperties """ - properties: Optional["_models.QuotaProperties"] = rest_field() + properties: Optional["_models.QuotaProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -739,11 +736,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class QuotaProperties(_model_base.Model): +class QuotaProperties(_Model): """The subscription quota resource properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar free_trial: The subscription quota resource free-trial properties. :vartype free_trial: ~azure.mgmt.playwrighttesting.models.FreeTrialProperties :ivar offering_type: Indicates the offering type for the subscription. Known values are: @@ -754,7 +749,9 @@ class QuotaProperties(_model_base.Model): :vartype provisioning_state: str or ~azure.mgmt.playwrighttesting.models.ProvisioningState """ - free_trial: Optional["_models.FreeTrialProperties"] = rest_field(name="freeTrial") + free_trial: Optional["_models.FreeTrialProperties"] = rest_field( + name="freeTrial", visibility=["read", "create", "update", "delete", "query"] + ) """The subscription quota resource free-trial properties.""" offering_type: Optional[Union[str, "_models.OfferingType"]] = rest_field(name="offeringType", visibility=["read"]) """Indicates the offering type for the subscription. Known values are: \"NotApplicable\", @@ -783,7 +780,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SystemData(_model_base.Model): +class SystemData(_Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. @@ -802,19 +799,29 @@ class SystemData(_model_base.Model): :vartype last_modified_at: ~datetime.datetime """ - created_by: Optional[str] = rest_field(name="createdBy") + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) """The identity that created the resource.""" - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="createdByType") + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that created the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource creation (UTC).""" - last_modified_by: Optional[str] = rest_field(name="lastModifiedBy") + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) """The identity that last modified the resource.""" - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="lastModifiedByType") + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that last modified the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - last_modified_at: Optional[datetime.datetime] = rest_field(name="lastModifiedAt", format="rfc3339") + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource last modification (UTC).""" @overload diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_patch.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_patch.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_operations.py index 07df81570497..effdc740de38 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_operations.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,12 +6,13 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase import json -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -32,16 +33,13 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize -from .._serialization import Serializer +from .._configuration import PlaywrightTestingMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -76,7 +74,7 @@ def build_accounts_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -105,7 +103,7 @@ def build_accounts_create_or_update_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -136,7 +134,7 @@ def build_accounts_update_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -166,7 +164,7 @@ def build_accounts_delete_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -194,7 +192,7 @@ def build_accounts_list_by_resource_group_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -276,7 +274,7 @@ def build_quotas_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -335,7 +333,7 @@ def build_account_quotas_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -364,7 +362,7 @@ def build_account_quotas_list_by_account_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -392,12 +390,14 @@ class Operations: :attr:`operations` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlaywrightTestingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -459,7 +459,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -493,12 +493,14 @@ class AccountsOperations: :attr:`accounts` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlaywrightTestingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: @@ -1138,7 +1140,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Account], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Account], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1222,7 +1224,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Account], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Account], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1387,12 +1389,14 @@ class QuotasOperations: :attr:`quotas` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlaywrightTestingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, location: str, quota_name: Union[str, _models.QuotaNames], **kwargs: Any) -> _models.Quota: @@ -1526,7 +1530,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Quota], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Quota], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1560,12 +1564,14 @@ class AccountQuotasOperations: :attr:`account_quotas` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlaywrightTestingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -1709,7 +1715,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AccountQuota], deserialized["value"]) + list_of_elem = _deserialize(List[_models.AccountQuota], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_patch.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_patch.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/setup.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/setup.py index dd28bf3e3e87..2d3f5c8cc1ca 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/setup.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", ) diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/tsp-location.yaml b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/tsp-location.yaml index 8883f3883170..8069dd6a0a41 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/tsp-location.yaml +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/playwrighttesting/PlaywrightTesting.Management -commit: 58740206b853320974ef5e4864f7be8120b15a27 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: