-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Loadtestservice - SDK initial review #25264
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
Merged
Merged
Changes from all commits
Commits
Show all changes
127 commits
Select commit
Hold shift + click to select a range
507ae4d
SDK generated autorest
Yashikaj14 9b6061c
upload function added
Yashikaj14 74eb518
patch.py changed
Yashikaj14 2d8eafd
upload updated
Yashikaj14 33c26d6
whl file removed
Yashikaj14 a91c728
whls deleted
Yashikaj14 9af9160
aio updated
Yashikaj14 081fd12
spell check added
Yashikaj14 fb9cb76
spell check
Yashikaj14 11d1531
Update shared_requirements.txt
msyyc 2be648f
Merge branch 'main' into loadtestservice
msyyc 1d98c14
Update MANIFEST.in
Yashikaj14 6881429
Update setup.py
Yashikaj14 b42ef95
spell added
Yashikaj14 3dea6da
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 0d1dbf3
patch.py updated
Yashikaj14 07abc8e
linting corrected
Yashikaj14 e43a9fb
Update allowed_pylint_failures.py
msyyc 4e2c523
readme updated
Yashikaj14 5e87691
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 7a6a769
patch.py updation
Yashikaj14 10fe0aa
Update _patch.py
Yashikaj14 5ac02da
tests added
Yashikaj14 806badd
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 3e3b655
async naming
Yashikaj14 015cf2e
test and result
BigCat20196 1204f67
fix
BigCat20196 8e27ba7
push the test result
BigCat20196 d577901
fix
Yashikaj14 5e08cc1
readme updated
Yashikaj14 df3e5b1
fix
Yashikaj14 b95aa58
tests added and async built
Yashikaj14 ed84eb0
yaml added
Yashikaj14 5959144
yaml updated
Yashikaj14 8703e03
sample and readme updated
Yashikaj14 0b6b1a5
fix ci.yml
Yashikaj14 592718d
Merge branch 'main' into loadtestservice
msyyc deb0b9c
more tests and samples addded and readme updated
Yashikaj14 6c6110e
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 2028ca3
tests
Yashikaj14 742cc82
fix
Yashikaj14 62eb9f1
fix2
Yashikaj14 ea5e975
type added
Yashikaj14 3edb300
type added
Yashikaj14 e8b0cff
Update CHANGELOG.md
msyyc 85a7208
chnaged to developer
d1d4d9e
Merge branch 'Azure:main' into yashika-loadtestservice
4047427
renamed package
08b2b8a
chnaged ci files
2649f5c
linting fixes
c1696e7
changed namespace from analytics to developer
6d18d56
Merge branch 'Azure:main' into yashika-loadtestservice
b341212
app_component naming cleaned
b49be9b
folded get_app_component
2cd4310
various name changes and added type hinting
277b22d
lint changes
29b3cb1
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
ff45aee
added wrapper for LoadTestClient
70ddd05
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
3f39ea4
removed msrest dependencies
05e96ef
corrected Serializer method
08e481a
test_smoke fixed
be1061f
fixes in aio class
80e09ca
updates samples
f68724d
namespace chg AppComponent, serverMetrics, test
a384829
updated samples
50cfcf0
namespace changes done
c8563b0
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
58e4964
LoadTestClient -> LoadTestingClient
924ccc7
apnd load_test to test_run & adminstration
37abf4e
added Readme Descirption
714f5e7
few changes in tests
9ffe28b
moved SUBSCRIPTION_ID to .env
d2254d7
resloved readme issues by @iscai-msft in #24744
568cc65
resolved #discussion_r925248158
deced9b
resolving other issue by @iscai-msft #24744
f29ccdd
#25264#discussion_r925284462
7dc92f0
cleaned tests
2207eae
Merge remote-tracking branch 'origin/main'
26758c4
namechanges
b4c17c9
resolved folding issues
78cadd6
Merge branch 'Azure:main' into main
e6aa88a
fixing dependencies verison
f8f7cf1
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
573bf9e
Merge branch 'main' of https://github.com/NiveditJain/azure-sdk-for-p…
e1e1153
added tests for _patch(es)
e053006
removed subs id from recordings
e723a75
fixing isodate requirements
4c398d9
removed SaaS key from smoke test
4a6d627
folder name chnage + setup.py cleaned
d989897
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
faddc05
Readme changes suggested by @msyyc
c558817
added dependencies in shared_requirements.txt
fe9a681
removed os.environ from tests
3307408
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
eac412d
liniting
ce66a8a
removed async test
cf979da
fixing tests
f44a41b
ci fix try
2e6b81f
trying dev_tools
f3039cb
fix for azure-mgmt-loadtestservice dev_reqs
scbedd bbdef79
Merge branch 'main' into main
7743fb3
added async tests
c26cd14
some tests
20e0cc2
cleaned setup
a162887
fixing async tests
7b66a7f
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
0c9ff64
added mgmt to loadtestservice to ci
a4564ac
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
919e95f
changed fie mode from json to BinaryIO
2cc19b9
reverting merge by @BigCat20196
e509d21
removed TEST_ID
d39dc05
Merge branch 'Azure:main' into main
e1e6b5d
solving issues by @lmazuel
1ef6f32
update with autorest6.1.0 and update tests
BigCat20196 3819643
update and format
BigCat20196 ea024ac
fix playback failed
BigCat20196 5ae8a12
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
59dfeb8
Merge branch 'main' of https://github.com/NiveditJain/azure-sdk-for-p…
0493ca9
Update test_smoke.test_create_or_update_test_run.yaml
msyyc 1c9c4e2
Update test_smoke.test_smoke_create_or_update_test.yaml
msyyc 9c2de2f
Update test_smoke_async.test_smoke_create_or_update_test.yaml
msyyc 084f491
updated README
23d98fe
Merge branch 'main' of https://github.com/NiveditJain/azure-sdk-for-p…
032e780
Merge branches 'main' and 'main' of https://github.com/Azure/azure-sd…
884c6ac
Merge branch 'main' into main
4f5a9a1
Merge branch 'main' into main
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Release History | ||
|
|
||
| ## 1.0.0b1 (2022-07-28) | ||
|
|
||
| - Initial version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| Copyright (c) Microsoft Corporation. | ||
|
|
||
| MIT License | ||
|
|
||
| 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 contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| include *.md | ||
| include LICENSE | ||
| include azure/developer/loadtesting/py.typed | ||
| recursive-include tests *.py | ||
| recursive-include samples *.py *.md | ||
| include azure/__init__.py | ||
| include azure/developer/__init__.py |
182 changes: 182 additions & 0 deletions
182
sdk/loadtestservice/azure-developer-loadtesting/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
|
|
||
| # Azure Developer LoadTesting client library for Python | ||
| Azure Developer LoadTesting provides client library in python to the user by which they can interact natively with Load Test Service.The service is for performing the load test to optimize application performance, scalability or capacity. The user can get the client-side and server-side metrices to see the details reported by the test engine and information about your Azure application components. | ||
|
|
||
|
|
||
| ## Getting started | ||
|
|
||
| ### Installating the package | ||
|
|
||
| ```bash | ||
| python -m pip install azure-developer-loadtesting | ||
| ``` | ||
|
|
||
| #### Prequisites | ||
|
|
||
| - Python 3.7 or later is required to use this package. | ||
| - You need an [Azure subscription][azure_sub] to use this package. | ||
| - An existing Azure Developer LoadTesting instance. | ||
| #### Create with an Azure Active Directory Credential | ||
| To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], | ||
| provide an instance of the desired credential type obtained from the | ||
| [azure-identity][azure_identity_credentials] library. | ||
|
|
||
| To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] | ||
|
|
||
| After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. | ||
| As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client: | ||
|
|
||
| Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: | ||
| `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` | ||
|
|
||
| Use the returned token credential to authenticate the client: | ||
|
|
||
| ```python | ||
| from azure.developer.loadtesting import LoadTestingClient | ||
| from azure.identity import DefaultAzureCredential | ||
| client = LoadTestingClient(endpoint='<endpoint>', credential=DefaultAzureCredential()) | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Creating a load test | ||
| ```python | ||
| from azure.developer.loadtesting import LoadTestingClient | ||
| from azure.identity import DefaultAzureCredential | ||
| from azure.core.exceptions import HttpResponseError | ||
|
|
||
| TEST_ID = "some-test-id" | ||
| DISPLAY_NAME = "new_namespace-new-namespace" | ||
| SUBSCRIPTION_ID = os.environ["SUBSCRIPTION_ID"] | ||
|
|
||
| client = LoadTestingClient(endpoint='<endpoint>', credential=DefaultAzureCredential()) | ||
|
|
||
| try: | ||
| result = client.load_test_administration.create_or_update_test( | ||
| TEST_ID, | ||
| { | ||
| "resourceId": f"/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/yashika-rg/providers/Microsoft.LoadTestService/loadtests/loadtestsdk", | ||
| "description": "", | ||
| "displayName": DISPLAY_NAME, | ||
| "loadTestConfig": { | ||
| "engineSize": "m", | ||
| "engineInstances": 1, | ||
| "splitAllCSVs": False, | ||
| }, | ||
| "secrets": {}, | ||
| "environmentVariables": {}, | ||
| "passFailCriteria": {"passFailMetrics": {}}, | ||
| "keyvaultReferenceIdentityType": "SystemAssigned", | ||
| "keyvaultReferenceIdentityId": None, | ||
| }, | ||
| ) | ||
| print(result) | ||
| except HttpResponseError as e: | ||
| print('service responds error: {}'.format(e.response.json())) | ||
|
|
||
| ``` | ||
|
|
||
| ### Uploading .jmx file to a Test | ||
| ```python | ||
| from azure.developer.loadtesting import LoadTestingClient | ||
| from azure.identity import DefaultAzureCredential | ||
| from azure.core.exceptions import HttpResponseError | ||
|
|
||
| TEST_ID = "some-test-id" | ||
| FILE_ID = "some-file-id" | ||
|
|
||
| client = LoadTestingClient(endpoint='<endpoint>', credential=DefaultAzureCredential()) | ||
|
|
||
| try: | ||
|
|
||
| result = client.load_test_administration.upload_test_file(TEST_ID, FILE_ID, open("sample.jmx", "rb")) | ||
| print(result) | ||
| except HttpResponseError as e: | ||
| print("Failed to send JSON message: {}".format(e.response.json())) | ||
| ``` | ||
|
|
||
| ### Running a Test | ||
| ```python | ||
| from azure.developer.loadtesting import LoadTestingClient | ||
| from azure.identity import DefaultAzureCredential | ||
| from azure.core.exceptions import HttpResponseError | ||
|
|
||
| TEST_ID = "some-test-id" | ||
| TEST_RUN_ID = "some-testrun-id" | ||
| DISPLAY_NAME = "new_namespace-new-namespace" | ||
|
|
||
| client = LoadTestingClient(endpoint='<endpoint>', credential=DefaultAzureCredential()) | ||
|
|
||
| try: | ||
| result = client.load_test_runs.create_and_update_test( | ||
lmazuel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| TEST_RUN_ID, | ||
| { | ||
| "testId": TEST_ID, | ||
| "displayName": DISPLAY_NAME, | ||
| "requestSamplers": [], | ||
| "errors": [], | ||
| "percentiles": ["90"], | ||
| "groupByInterval": "5s", | ||
| }, | ||
| ) | ||
| print(result) | ||
| except HttpResponseError as e: | ||
| print("Failed to send JSON message: {}".format(e.response.json())) | ||
| ``` | ||
| ## Key concepts | ||
| The following components make up the Azure Load Testing Service. The Azure Load Test client library for Python allows you to interact with each of these components through the use of a dedicated client object. | ||
|
|
||
| ### Load testing resource | ||
| The Load testing resource is the top-level resource for your load-testing activities. This resource provides a centralized place to view and manage load tests, test results, and related artifacts. A load testing resource contains zero or more load tests. | ||
|
|
||
| ### Test | ||
| A test specifies the test script, and configuration settings for running a load test. You can create one or more tests in an Azure Load Testing resource. | ||
|
|
||
| ### Test Engine | ||
| A test engine is computing infrastructure that runs the Apache JMeter test script. You can scale out your load test by configuring the number of test engines. The test script runs in parallel across the specified number of test engines. | ||
|
|
||
| ### Test Run | ||
| A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter script, the load test YAML configuration, the list of app components to monitor, and the results of the test. | ||
|
|
||
| ### App Component | ||
| When you run a load test for an Azure-hosted application, you can monitor resource metrics for the different Azure application components (server-side metrics). While the load test runs, and after completion of the test, you can monitor and analyze the resource metrics in the Azure Load Testing dashboard. | ||
|
|
||
| ### Metrics | ||
| During a load test, Azure Load Testing collects metrics about the test execution. There are two types of metrics: | ||
|
|
||
| 1. Client-side metrics give you details reported by the test engine. These metrics include the number of virtual users, the request response time, the number of failed requests, or the number of requests per second. | ||
|
|
||
| 2. Server-side metrics are available for Azure-hosted applications and provide information about your Azure application components. Metrics can be for the number of database reads, the type of HTTP responses, or container resource consumption. | ||
|
|
||
| ## Troubleshooting | ||
| More about it is coming soon... | ||
|
|
||
| ## Next steps | ||
|
|
||
| More examples are coming soon... | ||
|
|
||
| ## Contributing | ||
|
|
||
| This project welcomes contributions and suggestions. Most contributions require | ||
| you to agree to a Contributor License Agreement (CLA) declaring that you have | ||
| the right to, and actually do, grant us the rights to use your contribution. | ||
| For details, visit https://cla.microsoft.com. | ||
|
|
||
| When you submit a pull request, a CLA-bot will automatically determine whether | ||
| you need to provide a CLA and decorate the PR appropriately (e.g., label, | ||
| comment). Simply follow the instructions provided by the bot. You will only | ||
| need to do this once across all repos using our CLA. | ||
|
|
||
| This project has adopted the | ||
| [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, | ||
| see the Code of Conduct FAQ or contact opencode@microsoft.com with any | ||
| additional questions or comments. | ||
|
|
||
| <!-- LINKS --> | ||
| [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ | ||
| [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token | ||
| [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials | ||
| [azure_identity_pip]: https://pypi.org/project/azure-identity/ | ||
| [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential | ||
| [pip]: https://pypi.org/project/pip/ | ||
| [azure_sub]: https://azure.microsoft.com/free/ | ||
1 change: 1 addition & 0 deletions
1
sdk/loadtestservice/azure-developer-loadtesting/azure/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore |
1 change: 1 addition & 0 deletions
1
sdk/loadtestservice/azure-developer-loadtesting/azure/developer/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore |
24 changes: 24 additions & 0 deletions
24
sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # 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 ._client import LoadTestingClient | ||
| from ._version import VERSION | ||
|
|
||
| __version__ = VERSION | ||
|
|
||
| try: | ||
| from ._patch import __all__ as _patch_all | ||
| from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import | ||
| except ImportError: | ||
| _patch_all = [] | ||
| from ._patch import patch_sdk as _patch_sdk | ||
|
|
||
| __all__ = ["LoadTestingClient"] | ||
| __all__.extend([p for p in _patch_all if p not in __all__]) | ||
|
|
||
| _patch_sdk() |
98 changes: 98 additions & 0 deletions
98
sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/_client.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # 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 copy import deepcopy | ||
| from typing import Any, TYPE_CHECKING | ||
|
|
||
| from azure.core import PipelineClient | ||
| from azure.core.rest import HttpRequest, HttpResponse | ||
|
|
||
| from ._configuration import LoadTestingClientConfiguration | ||
| from ._serialization import Deserializer, Serializer | ||
| from .operations import AppComponentOperations, ServerMetricsOperations, TestOperations, TestRunOperations | ||
|
|
||
| if TYPE_CHECKING: | ||
| # pylint: disable=unused-import,ungrouped-imports | ||
| from typing import Dict | ||
|
|
||
| from azure.core.credentials import TokenCredential | ||
|
|
||
|
|
||
| class LoadTestingClient: # pylint: disable=client-accepts-api-version-keyword | ||
| """These APIs allow end users to create, view and run load tests using Azure Load Test Service. | ||
|
|
||
| :ivar app_component: AppComponentOperations operations | ||
| :vartype app_component: azure.developer.loadtesting.operations.AppComponentOperations | ||
| :ivar server_metrics: ServerMetricsOperations operations | ||
| :vartype server_metrics: azure.developer.loadtesting.operations.ServerMetricsOperations | ||
| :ivar test: TestOperations operations | ||
| :vartype test: azure.developer.loadtesting.operations.TestOperations | ||
| :ivar test_run: TestRunOperations operations | ||
| :vartype test_run: azure.developer.loadtesting.operations.TestRunOperations | ||
| :param endpoint: URL to perform data plane API operations on the resource. Required. | ||
| :type endpoint: str | ||
| :param credential: Credential needed for the client to connect to Azure. Required. | ||
| :type credential: ~azure.core.credentials.TokenCredential | ||
| :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding | ||
| this default value may result in unsupported behavior. | ||
| :paramtype api_version: str | ||
| """ | ||
|
|
||
| def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: | ||
| _endpoint = "https://{Endpoint}" | ||
| self._config = LoadTestingClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) | ||
| self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) | ||
|
|
||
| self._serialize = Serializer() | ||
| self._deserialize = Deserializer() | ||
| self._serialize.client_side_validation = False | ||
| self.app_component = AppComponentOperations(self._client, self._config, self._serialize, self._deserialize) | ||
| self.server_metrics = ServerMetricsOperations(self._client, self._config, self._serialize, self._deserialize) | ||
| self.test = TestOperations( # type: ignore # pylint: disable=abstract-class-instantiated | ||
| self._client, self._config, self._serialize, self._deserialize | ||
| ) | ||
| self.test_run = TestRunOperations(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. | ||
|
|
||
| >>> from azure.core.rest import HttpRequest | ||
| >>> request = HttpRequest("GET", "https://www.example.org/") | ||
| <HttpRequest [GET], url: 'https://www.example.org/'> | ||
| >>> response = client.send_request(request) | ||
| <HttpResponse: 200 OK> | ||
|
|
||
| For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request | ||
|
|
||
| :param request: The network request you want to make. Required. | ||
| :type request: ~azure.core.rest.HttpRequest | ||
| :keyword bool stream: Whether the response payload will be streamed. Defaults to False. | ||
| :return: The response of your network call. Does not do error handling on your response. | ||
| :rtype: ~azure.core.rest.HttpResponse | ||
| """ | ||
|
|
||
| request_copy = deepcopy(request) | ||
| path_format_arguments = { | ||
| "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), | ||
| } | ||
|
|
||
| request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) | ||
| return self._client.send_request(request_copy, **kwargs) | ||
|
|
||
| def close(self): | ||
| # type: () -> None | ||
| self._client.close() | ||
|
|
||
| def __enter__(self): | ||
| # type: () -> LoadTestingClient | ||
| self._client.__enter__() | ||
| return self | ||
|
|
||
| def __exit__(self, *exc_details): | ||
| # type: (Any) -> None | ||
| self._client.__exit__(*exc_details) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.