Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[AutoPR track2_azure-mgmt-playwrighttesting] Mjmadhu playwrighttesting microsoft.azure playwright service 2023 10 01 preview cp #5877

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "eeac7c84d823171f7d3e521621fc301b85b09cf8",
"commit": "70688bc4d3bf0b1ef56efbff23f51faef4d9d158",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"autorest_command": "autorest specification/playwrighttesting/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"autorest_command": "autorest specification/playwrighttesting/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"readme": "specification/playwrighttesting/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
@@ -27,16 +27,16 @@ class PlaywrightTestingMgmtClientConfiguration(Configuration): # pylint: disabl

:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-02-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(PlaywrightTestingMgmtClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-10-01-preview")
api_version: str = kwargs.pop("api_version", "2024-02-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Original file line number Diff line number Diff line change
@@ -15,29 +15,31 @@
from . import models as _models
from ._configuration import PlaywrightTestingMgmtClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import AccountsOperations, Operations, QuotasOperations
from .operations import AccountQuotasOperations, AccountsOperations, Operations, QuotasOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class PlaywrightTestingMgmtClient: # pylint: disable=client-accepts-api-version-keyword
"""Microsoft.AzurePlaywrightService Resource Provider management API.
"""Azure Playwright testing management service.

:ivar operations: Operations operations
:vartype operations: azure.mgmt.playwrighttesting.operations.Operations
:ivar accounts: AccountsOperations operations
:vartype accounts: azure.mgmt.playwrighttesting.operations.AccountsOperations
:ivar quotas: QuotasOperations operations
:vartype quotas: azure.mgmt.playwrighttesting.operations.QuotasOperations
:ivar account_quotas: AccountQuotasOperations operations
:vartype account_quotas: azure.mgmt.playwrighttesting.operations.AccountQuotasOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-02-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -63,6 +65,7 @@ def __init__(
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize)
self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
self.account_quotas = AccountQuotasOperations(self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
Original file line number Diff line number Diff line change
@@ -27,16 +27,16 @@ class PlaywrightTestingMgmtClientConfiguration(Configuration): # pylint: disabl

:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-02-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(PlaywrightTestingMgmtClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-10-01-preview")
api_version: str = kwargs.pop("api_version", "2024-02-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Original file line number Diff line number Diff line change
@@ -15,29 +15,31 @@
from .. import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import PlaywrightTestingMgmtClientConfiguration
from .operations import AccountsOperations, Operations, QuotasOperations
from .operations import AccountQuotasOperations, AccountsOperations, Operations, QuotasOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential


class PlaywrightTestingMgmtClient: # pylint: disable=client-accepts-api-version-keyword
"""Microsoft.AzurePlaywrightService Resource Provider management API.
"""Azure Playwright testing management service.

:ivar operations: Operations operations
:vartype operations: azure.mgmt.playwrighttesting.aio.operations.Operations
:ivar accounts: AccountsOperations operations
:vartype accounts: azure.mgmt.playwrighttesting.aio.operations.AccountsOperations
:ivar quotas: QuotasOperations operations
:vartype quotas: azure.mgmt.playwrighttesting.aio.operations.QuotasOperations
:ivar account_quotas: AccountQuotasOperations operations
:vartype account_quotas: azure.mgmt.playwrighttesting.aio.operations.AccountQuotasOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2024-02-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -63,6 +65,7 @@ def __init__(
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize)
self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
self.account_quotas = AccountQuotasOperations(self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
from ._operations import Operations
from ._accounts_operations import AccountsOperations
from ._quotas_operations import QuotasOperations
from ._account_quotas_operations import AccountQuotasOperations

from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@@ -18,6 +19,7 @@
"Operations",
"AccountsOperations",
"QuotasOperations",
"AccountQuotasOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._account_quotas_operations import build_get_request, build_list_by_account_request

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]


class AccountQuotasOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.

Instead, you should access the following operations through
:class:`~azure.mgmt.playwrighttesting.aio.PlaywrightTestingMgmtClient`'s
:attr:`account_quotas` attribute.
"""

models = _models

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")

@distributed_trace
def list_by_account(
self, resource_group_name: str, account_name: str, **kwargs: Any
) -> AsyncIterable["_models.AccountQuota"]:
"""List quotas for a given account.

:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Name of account. Required.
:type account_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccountQuota or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.playwrighttesting.models.AccountQuota]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AccountQuotaListResult] = kwargs.pop("cls", None)

error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

def prepare_request(next_link=None):
if not next_link:

request = build_list_by_account_request(
resource_group_name=resource_group_name,
account_name=account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_account.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request

async def extract_data(pipeline_response):
deserialized = self._deserialize("AccountQuotaListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)

async def get_next(next_link=None):
request = prepare_request(next_link)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

return pipeline_response

return AsyncItemPaged(get_next, extract_data)

list_by_account.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas"
}

@distributed_trace_async
async def get(
self, resource_group_name: str, account_name: str, quota_name: Union[str, _models.QuotaNames], **kwargs: Any
) -> _models.AccountQuota:
"""Get quota by name for an account.

:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param account_name: Name of account. Required.
:type account_name: str
:param quota_name: The Playwright service account quota name. "ScalableExecution" Required.
:type quota_name: str or ~azure.mgmt.playwrighttesting.models.QuotaNames
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AccountQuota or the result of cls(response)
:rtype: ~azure.mgmt.playwrighttesting.models.AccountQuota
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AccountQuota] = kwargs.pop("cls", None)

request = build_get_request(
resource_group_name=resource_group_name,
account_name=account_name,
quota_name=quota_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize("AccountQuota", pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}"
}
Loading