Skip to content

Commit 1933330

Browse files
author
SDKAuto
committed
CodeGen from PR 32919 in Azure/azure-rest-api-specs
Merge 987e160e669bd8bd6ad3b479a44ec8f543a22cf8 into 8e015e1d91c33639940fb36fa7f2c357665ff6dc
1 parent 67c3f50 commit 1933330

Some content is hidden

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

51 files changed

+6529
-5207
lines changed

sdk/loadtesting/azure-mgmt-loadtesting/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Loadtesting Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.7+ is required to use this package.
15+
- Python 3.8+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -45,8 +45,9 @@ client = LoadTestMgmtClient(credential=DefaultAzureCredential(), subscription_id
4545

4646
## Examples
4747

48-
49-
Code samples for this package can be found at [Loadtesting Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
48+
Code samples for this package can be found at:
49+
- [Search Loadtesting Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
5051

5152

5253
## Troubleshooting
@@ -58,6 +59,3 @@ Code samples for this package can be found at [Loadtesting Management](https://d
5859
If you encounter any bugs or have suggestions, please file an issue in the
5960
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
6061
section of the project.
61-
62-
63-
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "269c77bb83979703db9df46784effa70d9eed1e1",
2+
"commit": "a4f57d6542679fa11866345756f9251b51394353",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/loadtestservice/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/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
10-
"readme": "specification/loadtestservice/resource-manager/readme.md"
4+
"typespec_src": "specification/loadtestservice/LoadTestService.Management",
5+
"@azure-tools/typespec-python": "0.38.4"
116
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"CrossLanguagePackageId": "Microsoft.LoadTestService",
3+
"CrossLanguageDefinitionId": {
4+
"azure.mgmt.loadtesting.models.CheckQuotaAvailabilityResponse": "Microsoft.LoadTestService.CheckQuotaAvailabilityResponse",
5+
"azure.mgmt.loadtesting.models.CheckQuotaAvailabilityResponseProperties": "Microsoft.LoadTestService.CheckQuotaAvailabilityResponseProperties",
6+
"azure.mgmt.loadtesting.models.EncryptionProperties": "Microsoft.LoadTestService.EncryptionProperties",
7+
"azure.mgmt.loadtesting.models.EncryptionPropertiesIdentity": "Microsoft.LoadTestService.EncryptionPropertiesIdentity",
8+
"azure.mgmt.loadtesting.models.EndpointDependency": "Microsoft.LoadTestService.EndpointDependency",
9+
"azure.mgmt.loadtesting.models.EndpointDetail": "Microsoft.LoadTestService.EndpointDetail",
10+
"azure.mgmt.loadtesting.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo",
11+
"azure.mgmt.loadtesting.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail",
12+
"azure.mgmt.loadtesting.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse",
13+
"azure.mgmt.loadtesting.models.LoadTestProperties": "Microsoft.LoadTestService.LoadTestProperties",
14+
"azure.mgmt.loadtesting.models.Resource": "Azure.ResourceManager.CommonTypes.Resource",
15+
"azure.mgmt.loadtesting.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
16+
"azure.mgmt.loadtesting.models.LoadTestResource": "Microsoft.LoadTestService.LoadTestResource",
17+
"azure.mgmt.loadtesting.models.LoadTestResourceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel",
18+
"azure.mgmt.loadtesting.models.LoadTestResourceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties",
19+
"azure.mgmt.loadtesting.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity",
20+
"azure.mgmt.loadtesting.models.OutboundEnvironmentEndpoint": "Microsoft.LoadTestService.OutboundEnvironmentEndpoint",
21+
"azure.mgmt.loadtesting.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource",
22+
"azure.mgmt.loadtesting.models.QuotaBucketRequest": "Microsoft.LoadTestService.QuotaBucketRequest",
23+
"azure.mgmt.loadtesting.models.QuotaBucketRequestProperties": "Microsoft.LoadTestService.QuotaBucketRequestProperties",
24+
"azure.mgmt.loadtesting.models.QuotaBucketRequestPropertiesDimensions": "Microsoft.LoadTestService.QuotaBucketRequestPropertiesDimensions",
25+
"azure.mgmt.loadtesting.models.QuotaResource": "Microsoft.LoadTestService.QuotaResource",
26+
"azure.mgmt.loadtesting.models.QuotaResourceProperties": "Microsoft.LoadTestService.QuotaResourceProperties",
27+
"azure.mgmt.loadtesting.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData",
28+
"azure.mgmt.loadtesting.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity",
29+
"azure.mgmt.loadtesting.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
30+
"azure.mgmt.loadtesting.models.ResourceState": "Microsoft.LoadTestService.ResourceState",
31+
"azure.mgmt.loadtesting.models.Type": "Microsoft.LoadTestService.type",
32+
"azure.mgmt.loadtesting.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType",
33+
"azure.mgmt.loadtesting.LoadTestMgmtClient.list_by_subscription": "Customizations.LoadTests.listBySubscription",
34+
"azure.mgmt.loadtesting.LoadTestMgmtClient.list_by_resource_group": "Customizations.LoadTests.listByResourceGroup",
35+
"azure.mgmt.loadtesting.LoadTestMgmtClient.get_loadtest": "Customizations.LoadTests.getLoadtest",
36+
"azure.mgmt.loadtesting.LoadTestMgmtClient.begin_create_or_update_loadtest": "Customizations.LoadTests.createOrUpdateLoadtest",
37+
"azure.mgmt.loadtesting.LoadTestMgmtClient.begin_update_loadtest": "Customizations.LoadTests.updateLoadtest",
38+
"azure.mgmt.loadtesting.LoadTestMgmtClient.begin_delete_loadtest": "Customizations.LoadTests.deleteLoadtest",
39+
"azure.mgmt.loadtesting.LoadTestMgmtClient.outbound_network_dependencies_endpoints": "Customizations.LoadTests.outboundNetworkDependenciesEndpoints",
40+
"azure.mgmt.loadtesting.LoadTestMgmtClient.get_quota": "Customizations.LoadTests.getQuota",
41+
"azure.mgmt.loadtesting.LoadTestMgmtClient.list_quota": "Customizations.LoadTests.listQuota",
42+
"azure.mgmt.loadtesting.LoadTestMgmtClient.check_availability_quota": "Customizations.LoadTests.checkAvailabilityQuota"
43+
}
44+
}

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._load_test_mgmt_client import LoadTestMgmtClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import LoadTestMgmtClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"LoadTestMgmtClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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) Python 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+
from typing_extensions import Self
12+
13+
from azure.core.pipeline import policies
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
17+
18+
from ._configuration import LoadTestMgmtClientConfiguration
19+
from ._operations import LoadTestMgmtClientOperationsMixin
20+
from ._serialization import Deserializer, Serializer
21+
22+
if TYPE_CHECKING:
23+
from azure.core.credentials import TokenCredential
24+
25+
26+
class LoadTestMgmtClient(LoadTestMgmtClientOperationsMixin):
27+
"""LoadTestMgmtClient.
28+
29+
:param credential: Credential used to authenticate requests to the service. Required.
30+
:type credential: ~azure.core.credentials.TokenCredential
31+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
32+
:type subscription_id: str
33+
:param base_url: Service host. Default value is "https://management.azure.com".
34+
:type base_url: str
35+
:keyword api_version: The API version to use for this operation. Default value is
36+
"2024-12-01-preview". Note that overriding this default value may result in unsupported
37+
behavior.
38+
:paramtype api_version: str
39+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
40+
Retry-After header is present.
41+
"""
42+
43+
def __init__(
44+
self,
45+
credential: "TokenCredential",
46+
subscription_id: str,
47+
base_url: str = "https://management.azure.com",
48+
**kwargs: Any
49+
) -> None:
50+
_endpoint = "{endpoint}"
51+
self._config = LoadTestMgmtClientConfiguration(
52+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
53+
)
54+
_policies = kwargs.pop("policies", None)
55+
if _policies is None:
56+
_policies = [
57+
policies.RequestIdPolicy(**kwargs),
58+
self._config.headers_policy,
59+
self._config.user_agent_policy,
60+
self._config.proxy_policy,
61+
policies.ContentDecodePolicy(**kwargs),
62+
ARMAutoResourceProviderRegistrationPolicy(),
63+
self._config.redirect_policy,
64+
self._config.retry_policy,
65+
self._config.authentication_policy,
66+
self._config.custom_hook_policy,
67+
self._config.logging_policy,
68+
policies.DistributedTracingPolicy(**kwargs),
69+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
70+
self._config.http_logging_policy,
71+
]
72+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
73+
74+
self._serialize = Serializer()
75+
self._deserialize = Deserializer()
76+
self._serialize.client_side_validation = False
77+
78+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
79+
"""Runs the network request through the client's chained policies.
80+
81+
>>> from azure.core.rest import HttpRequest
82+
>>> request = HttpRequest("GET", "https://www.example.org/")
83+
<HttpRequest [GET], url: 'https://www.example.org/'>
84+
>>> response = client.send_request(request)
85+
<HttpResponse: 200 OK>
86+
87+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
88+
89+
:param request: The network request you want to make. Required.
90+
:type request: ~azure.core.rest.HttpRequest
91+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
92+
:return: The response of your network call. Does not do error handling on your response.
93+
:rtype: ~azure.core.rest.HttpResponse
94+
"""
95+
96+
request_copy = deepcopy(request)
97+
path_format_arguments = {
98+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
99+
}
100+
101+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
102+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
103+
104+
def close(self) -> None:
105+
self._client.close()
106+
107+
def __enter__(self) -> Self:
108+
self._client.__enter__()
109+
return self
110+
111+
def __exit__(self, *exc_details: Any) -> None:
112+
self._client.__exit__(*exc_details)

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,47 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

12-
from azure.core.configuration import Configuration
1311
from azure.core.pipeline import policies
1412
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1513

1614
from ._version import VERSION
1715

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2316
if TYPE_CHECKING:
24-
# pylint: disable=unused-import,ungrouped-imports
2517
from azure.core.credentials import TokenCredential
2618

2719

28-
class LoadTestMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class LoadTestMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes
2921
"""Configuration for LoadTestMgmtClient.
3022
3123
Note that all parameters used to create this instance are saved as instance
3224
attributes.
3325
34-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
3527
:type credential: ~azure.core.credentials.TokenCredential
36-
:param subscription_id: The ID of the target subscription. Required.
28+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3729
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this
39-
default value may result in unsupported behavior.
30+
:param base_url: Service host. Default value is "https://management.azure.com".
31+
:type base_url: str
32+
:keyword api_version: The API version to use for this operation. Default value is
33+
"2024-12-01-preview". Note that overriding this default value may result in unsupported
34+
behavior.
4035
:paramtype api_version: str
4136
"""
4237

43-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
44-
super(LoadTestMgmtClientConfiguration, self).__init__(**kwargs)
45-
api_version: Literal["2022-12-01"] = kwargs.pop("api_version", "2022-12-01")
38+
def __init__(
39+
self,
40+
credential: "TokenCredential",
41+
subscription_id: str,
42+
base_url: str = "https://management.azure.com",
43+
**kwargs: Any
44+
) -> None:
45+
api_version: str = kwargs.pop("api_version", "2024-12-01-preview")
4646

4747
if credential is None:
4848
raise ValueError("Parameter 'credential' must not be None.")
@@ -51,9 +51,11 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5151

5252
self.credential = credential
5353
self.subscription_id = subscription_id
54+
self.base_url = base_url
5455
self.api_version = api_version
5556
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5657
kwargs.setdefault("sdk_moniker", "mgmt-loadtesting/{}".format(VERSION))
58+
self.polling_interval = kwargs.get("polling_interval", 30)
5759
self._configure(**kwargs)
5860

5961
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +64,9 @@ def _configure(self, **kwargs: Any) -> None:
6264
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6365
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6466
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
65-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6667
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6768
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
69+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6870
self.authentication_policy = kwargs.get("authentication_policy")
6971
if self.credential and not self.authentication_policy:
7072
self.authentication_policy = ARMChallengeAuthenticationPolicy(

0 commit comments

Comments
 (0)