Skip to content

Commit

Permalink
CodeGen from PR 19419 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 19b2683337e20499630da86bde789f2ff51f6581 into e7bcafa885ef773c6309d6a8f3a65c5019df413d
  • Loading branch information
SDKAuto committed Jun 13, 2022
1 parent 82193ba commit ea3a9ea
Show file tree
Hide file tree
Showing 49 changed files with 8,438 additions and 7,243 deletions.
10 changes: 5 additions & 5 deletions sdk/testbase/azure-mgmt-testbase/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.4.2",
"autorest": "3.7.2",
"use": [
"@autorest/python@5.8.0",
"@autorest/modelerfour@4.19.2"
"@autorest/python@5.13.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "cc49d9f58b73e725182d13b9c62f8c6d2e241ce5",
"commit": "b0bd68e759d0f85d233dd951f2db81516204f56b",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/testbase/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.2 --version=3.4.2",
"autorest_command": "autorest specification/testbase/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"readme": "specification/testbase/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
__version__ = VERSION
__all__ = ['TestBase']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential


class TestBaseConfiguration(Configuration):
class TestBaseConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for TestBase.
Note that all parameters used to create this instance are saved as instance
Expand All @@ -31,24 +29,28 @@ class TestBaseConfiguration(Configuration):
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-04-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
super(TestBaseConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2022-04-01-preview") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(TestBaseConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-12-16-preview"
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-testbase/{}'.format(VERSION))
self._configure(**kwargs)
Expand All @@ -68,4 +70,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
117 changes: 0 additions & 117 deletions sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_metadata.json

This file was deleted.

31 changes: 31 additions & 0 deletions sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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.
#
# --------------------------------------------------------------------------

# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
Loading

0 comments on commit ea3a9ea

Please sign in to comment.