Skip to content

Commit 76cf342

Browse files
author
SDKAuto
committed
CodeGen from PR 20917 in Azure/azure-rest-api-specs
Merge eedda8e42be254e5f25f246f636b4101d0735544 into 4994cbed850f3726721ec6fd3235a474e8d08fcc
1 parent 25ca3db commit 76cf342

31 files changed

+5894
-2016
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.4.5",
2+
"autorest": "3.9.2",
33
"use": [
4-
"@autorest/python@5.8.4",
5-
"@autorest/modelerfour@4.19.2"
4+
"@autorest/python@6.1.6",
5+
"@autorest/modelerfour@4.24.3"
66
],
7-
"commit": "547fc2c120bac50455ab85831747d7041a2cc4ea",
7+
"commit": "2372d972ed9a13140c57781e7c16b354b0b8a5f2",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/loadtestservice/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.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5",
9+
"autorest_command": "autorest specification/loadtestservice/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.1.6 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/loadtestservice/resource-manager/readme.md"
1111
}

sdk/loadtestservice/azure-mgmt-loadtestservice/azure/mgmt/loadtestservice/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._load_test_client import LoadTestClient
9+
from ._load_test_mgmt_client import LoadTestMgmtClient
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['LoadTestClient']
1413

1514
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
1817
except ImportError:
19-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = ["LoadTestMgmtClient"]
22+
__all__.extend([p for p in _patch_all if p not in __all__])
23+
24+
_patch_sdk()

sdk/loadtestservice/azure-mgmt-loadtestservice/azure/mgmt/loadtestservice/_configuration.py

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,64 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1414

1515
from ._version import VERSION
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

24-
class LoadTestClientConfiguration(Configuration):
25-
"""Configuration for LoadTestClient.
22+
class LoadTestMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
23+
"""Configuration for LoadTestMgmtClient.
2624
2725
Note that all parameters used to create this instance are saved as instance
2826
attributes.
2927
30-
:param credential: Credential needed for the client to connect to Azure.
28+
:param credential: Credential needed for the client to connect to Azure. Required.
3129
:type credential: ~azure.core.credentials.TokenCredential
32-
:param subscription_id: The ID of the target subscription.
30+
:param subscription_id: The ID of the target subscription. Required.
3331
:type subscription_id: str
32+
:keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this
33+
default value may result in unsupported behavior.
34+
:paramtype api_version: str
3435
"""
3536

36-
def __init__(
37-
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
37+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38+
super(LoadTestMgmtClientConfiguration, self).__init__(**kwargs)
39+
api_version = kwargs.pop("api_version", "2022-12-01") # type: str
40+
4341
if credential is None:
4442
raise ValueError("Parameter 'credential' must not be None.")
4543
if subscription_id is None:
4644
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(LoadTestClientConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
51-
self.api_version = "2021-12-01-preview"
52-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
53-
kwargs.setdefault('sdk_moniker', 'mgmt-loadtestservice/{}'.format(VERSION))
48+
self.api_version = api_version
49+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
50+
kwargs.setdefault("sdk_moniker", "mgmt-loadtestservice/{}".format(VERSION))
5451
self._configure(**kwargs)
5552

5653
def _configure(
57-
self,
58-
**kwargs # type: Any
54+
self, **kwargs # type: Any
5955
):
6056
# type: (...) -> None
61-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
62-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
63-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
64-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
65-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
66-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
67-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
68-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
69-
self.authentication_policy = kwargs.get('authentication_policy')
57+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
58+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
59+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
60+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
61+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
62+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
63+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
64+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
65+
self.authentication_policy = kwargs.get("authentication_policy")
7066
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
68+
self.credential, *self.credential_scopes, **kwargs
69+
)

sdk/loadtestservice/azure-mgmt-loadtestservice/azure/mgmt/loadtestservice/_load_test_client.py

Lines changed: 0 additions & 94 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
11+
12+
from azure.core.rest import HttpRequest, HttpResponse
13+
from azure.mgmt.core import ARMPipelineClient
14+
15+
from . import models
16+
from ._configuration import LoadTestMgmtClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import LoadTestsOperations, Operations, QuotasOperations
19+
20+
if TYPE_CHECKING:
21+
# pylint: disable=unused-import,ungrouped-imports
22+
from azure.core.credentials import TokenCredential
23+
24+
25+
class LoadTestMgmtClient: # pylint: disable=client-accepts-api-version-keyword
26+
"""LoadTest client provides access to LoadTest Resource and it's status operations.
27+
28+
:ivar operations: Operations operations
29+
:vartype operations: azure.mgmt.loadtestservice.operations.Operations
30+
:ivar quotas: QuotasOperations operations
31+
:vartype quotas: azure.mgmt.loadtestservice.operations.QuotasOperations
32+
:ivar load_tests: LoadTestsOperations operations
33+
:vartype load_tests: azure.mgmt.loadtestservice.operations.LoadTestsOperations
34+
:param credential: Credential needed for the client to connect to Azure. Required.
35+
:type credential: ~azure.core.credentials.TokenCredential
36+
:param subscription_id: The ID of the target subscription. Required.
37+
:type subscription_id: str
38+
:param base_url: Service URL. Default value is "https://management.azure.com".
39+
:type base_url: str
40+
:keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this
41+
default value may result in unsupported behavior.
42+
:paramtype api_version: str
43+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
44+
Retry-After header is present.
45+
"""
46+
47+
def __init__(
48+
self,
49+
credential: "TokenCredential",
50+
subscription_id: str,
51+
base_url: str = "https://management.azure.com",
52+
**kwargs: Any
53+
) -> None:
54+
self._config = LoadTestMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
55+
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
56+
57+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
58+
self._serialize = Serializer(client_models)
59+
self._deserialize = Deserializer(client_models)
60+
self._serialize.client_side_validation = False
61+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
62+
self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
63+
self.load_tests = LoadTestsOperations(self._client, self._config, self._serialize, self._deserialize)
64+
65+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
66+
"""Runs the network request through the client's chained policies.
67+
68+
>>> from azure.core.rest import HttpRequest
69+
>>> request = HttpRequest("GET", "https://www.example.org/")
70+
<HttpRequest [GET], url: 'https://www.example.org/'>
71+
>>> response = client._send_request(request)
72+
<HttpResponse: 200 OK>
73+
74+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
75+
76+
:param request: The network request you want to make. Required.
77+
:type request: ~azure.core.rest.HttpRequest
78+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
79+
:return: The response of your network call. Does not do error handling on your response.
80+
:rtype: ~azure.core.rest.HttpResponse
81+
"""
82+
83+
request_copy = deepcopy(request)
84+
request_copy.url = self._client.format_url(request_copy.url)
85+
return self._client.send_request(request_copy, **kwargs)
86+
87+
def close(self):
88+
# type: () -> None
89+
self._client.close()
90+
91+
def __enter__(self):
92+
# type: () -> LoadTestMgmtClient
93+
self._client.__enter__()
94+
return self
95+
96+
def __exit__(self, *exc_details):
97+
# type: (Any) -> None
98+
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)