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

Loadtestservice - SDK initial review #25264

Merged
merged 127 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
507ae4d
SDK generated autorest
Yashikaj14 Jun 6, 2022
9b6061c
upload function added
Yashikaj14 Jun 6, 2022
74eb518
patch.py changed
Yashikaj14 Jun 8, 2022
2d8eafd
upload updated
Yashikaj14 Jun 8, 2022
33c26d6
whl file removed
Yashikaj14 Jun 9, 2022
a91c728
whls deleted
Yashikaj14 Jun 9, 2022
9af9160
aio updated
Yashikaj14 Jun 9, 2022
081fd12
spell check added
Yashikaj14 Jun 9, 2022
fb9cb76
spell check
Yashikaj14 Jun 11, 2022
11d1531
Update shared_requirements.txt
msyyc Jun 13, 2022
2be648f
Merge branch 'main' into loadtestservice
msyyc Jun 13, 2022
1d98c14
Update MANIFEST.in
Yashikaj14 Jun 13, 2022
6881429
Update setup.py
Yashikaj14 Jun 13, 2022
b42ef95
spell added
Yashikaj14 Jun 13, 2022
3dea6da
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 Jun 13, 2022
0d1dbf3
patch.py updated
Yashikaj14 Jun 13, 2022
07abc8e
linting corrected
Yashikaj14 Jun 14, 2022
e43a9fb
Update allowed_pylint_failures.py
msyyc Jun 14, 2022
4e2c523
readme updated
Yashikaj14 Jun 14, 2022
5e87691
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 Jun 14, 2022
7a6a769
patch.py updation
Yashikaj14 Jun 14, 2022
10fe0aa
Update _patch.py
Yashikaj14 Jun 15, 2022
5ac02da
tests added
Yashikaj14 Jun 15, 2022
806badd
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 Jun 15, 2022
3e3b655
async naming
Yashikaj14 Jun 15, 2022
015cf2e
test and result
BigCat20196 Jun 15, 2022
1204f67
fix
BigCat20196 Jun 15, 2022
8e27ba7
push the test result
BigCat20196 Jun 15, 2022
d577901
fix
Yashikaj14 Jun 15, 2022
5e08cc1
readme updated
Yashikaj14 Jun 15, 2022
df3e5b1
fix
Yashikaj14 Jun 15, 2022
b95aa58
tests added and async built
Yashikaj14 Jun 15, 2022
ed84eb0
yaml added
Yashikaj14 Jun 15, 2022
5959144
yaml updated
Yashikaj14 Jun 15, 2022
8703e03
sample and readme updated
Yashikaj14 Jun 16, 2022
0b6b1a5
fix ci.yml
Yashikaj14 Jun 16, 2022
592718d
Merge branch 'main' into loadtestservice
msyyc Jun 20, 2022
deb0b9c
more tests and samples addded and readme updated
Yashikaj14 Jun 20, 2022
6c6110e
Merge branch 'loadtestservice' of https://github.com/Yashikaj14/azure…
Yashikaj14 Jun 20, 2022
2028ca3
tests
Yashikaj14 Jun 21, 2022
742cc82
fix
Yashikaj14 Jun 21, 2022
62eb9f1
fix2
Yashikaj14 Jun 21, 2022
ea5e975
type added
Yashikaj14 Jun 28, 2022
3edb300
type added
Yashikaj14 Jun 28, 2022
e8b0cff
Update CHANGELOG.md
msyyc Jul 5, 2022
85a7208
chnaged to developer
Jul 15, 2022
d1d4d9e
Merge branch 'Azure:main' into yashika-loadtestservice
Jul 15, 2022
4047427
renamed package
Jul 15, 2022
08b2b8a
chnaged ci files
Jul 15, 2022
2649f5c
linting fixes
Jul 15, 2022
c1696e7
changed namespace from analytics to developer
Jul 17, 2022
6d18d56
Merge branch 'Azure:main' into yashika-loadtestservice
Jul 18, 2022
b341212
app_component naming cleaned
Jul 18, 2022
b49be9b
folded get_app_component
Jul 18, 2022
2cd4310
various name changes and added type hinting
Jul 18, 2022
277b22d
lint changes
Jul 18, 2022
29b3cb1
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 18, 2022
ff45aee
added wrapper for LoadTestClient
Jul 18, 2022
70ddd05
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 19, 2022
3f39ea4
removed msrest dependencies
Jul 19, 2022
05e96ef
corrected Serializer method
Jul 19, 2022
08e481a
test_smoke fixed
Jul 19, 2022
be1061f
fixes in aio class
Jul 19, 2022
80e09ca
updates samples
Jul 19, 2022
f68724d
namespace chg AppComponent, serverMetrics, test
Jul 19, 2022
a384829
updated samples
Jul 19, 2022
50cfcf0
namespace changes done
Jul 20, 2022
c8563b0
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 20, 2022
58e4964
LoadTestClient -> LoadTestingClient
Jul 20, 2022
924ccc7
apnd load_test to test_run & adminstration
Jul 20, 2022
37abf4e
added Readme Descirption
Jul 20, 2022
714f5e7
few changes in tests
Jul 20, 2022
9ffe28b
moved SUBSCRIPTION_ID to .env
Jul 20, 2022
d2254d7
resloved readme issues by @iscai-msft in #24744
Jul 20, 2022
568cc65
resolved #discussion_r925248158
Jul 20, 2022
deced9b
resolving other issue by @iscai-msft #24744
Jul 20, 2022
f29ccdd
#25264#discussion_r925284462
Jul 20, 2022
7dc92f0
cleaned tests
Jul 20, 2022
2207eae
Merge remote-tracking branch 'origin/main'
Jul 21, 2022
26758c4
namechanges
Jul 21, 2022
b4c17c9
resolved folding issues
Jul 21, 2022
78cadd6
Merge branch 'Azure:main' into main
NiveditJain Jul 21, 2022
e6aa88a
fixing dependencies verison
Jul 21, 2022
f8f7cf1
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 21, 2022
573bf9e
Merge branch 'main' of https://github.com/NiveditJain/azure-sdk-for-p…
Jul 21, 2022
e1e1153
added tests for _patch(es)
Jul 21, 2022
e053006
removed subs id from recordings
Jul 21, 2022
e723a75
fixing isodate requirements
Jul 21, 2022
4c398d9
removed SaaS key from smoke test
Jul 21, 2022
4a6d627
folder name chnage + setup.py cleaned
Jul 22, 2022
d989897
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 22, 2022
faddc05
Readme changes suggested by @msyyc
Jul 22, 2022
c558817
added dependencies in shared_requirements.txt
Jul 22, 2022
fe9a681
removed os.environ from tests
Jul 22, 2022
3307408
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 22, 2022
eac412d
liniting
Jul 22, 2022
ce66a8a
removed async test
Jul 22, 2022
cf979da
fixing tests
Jul 22, 2022
f44a41b
ci fix try
Jul 22, 2022
2e6b81f
trying dev_tools
Jul 22, 2022
f3039cb
fix for azure-mgmt-loadtestservice dev_reqs
scbedd Jul 22, 2022
bbdef79
Merge branch 'main' into main
NiveditJain Jul 25, 2022
7743fb3
added async tests
Jul 25, 2022
c26cd14
some tests
Jul 25, 2022
20e0cc2
cleaned setup
Jul 25, 2022
a162887
fixing async tests
Jul 25, 2022
7b66a7f
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 25, 2022
0c9ff64
added mgmt to loadtestservice to ci
Jul 25, 2022
a4564ac
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 26, 2022
919e95f
changed fie mode from json to BinaryIO
Jul 26, 2022
2cc19b9
reverting merge by @BigCat20196
Jul 26, 2022
e509d21
removed TEST_ID
Jul 26, 2022
d39dc05
Merge branch 'Azure:main' into main
NiveditJain Jul 27, 2022
e1e6b5d
solving issues by @lmazuel
Jul 27, 2022
1ef6f32
update with autorest6.1.0 and update tests
BigCat20196 Jul 27, 2022
3819643
update and format
BigCat20196 Jul 27, 2022
ea024ac
fix playback failed
BigCat20196 Jul 27, 2022
5ae8a12
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python
Jul 27, 2022
59dfeb8
Merge branch 'main' of https://github.com/NiveditJain/azure-sdk-for-p…
Jul 27, 2022
0493ca9
Update test_smoke.test_create_or_update_test_run.yaml
msyyc Jul 27, 2022
1c9c4e2
Update test_smoke.test_smoke_create_or_update_test.yaml
msyyc Jul 27, 2022
9c2de2f
Update test_smoke_async.test_smoke_create_or_update_test.yaml
msyyc Jul 27, 2022
084f491
updated README
Jul 27, 2022
23d98fe
Merge branch 'main' of https://github.com/NiveditJain/azure-sdk-for-p…
Jul 27, 2022
032e780
Merge branches 'main' and 'main' of https://github.com/Azure/azure-sd…
Jul 27, 2022
884c6ac
Merge branch 'main' into main
NiveditJain Jul 28, 2022
4f5a9a1
Merge branch 'main' into main
NiveditJain Jul 29, 2022
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
7 changes: 7 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/**",
"sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/job_name_generator.py",
"sdk/ml/azure-ai-ml/tests/**",
"sdk/loadtestservice/azure-developer-loadtesting/**",
"sdk/monitor/azure-monitor-ingestion/**",
"eng/**/*.json",
"eng/*.txt",
Expand Down Expand Up @@ -463,6 +464,12 @@
"undoc"
]
},
{
"filename": "sdk/loadtestservice/azure-developer-loadtesting/azure/developer/loadtesting/**",
"words":[
"vusers"
]
},
msyyc marked this conversation as resolved.
Show resolved Hide resolved
{
"filename": "sdk/ml/azure-ai-ml/**",
"words": [
Expand Down
3 changes: 2 additions & 1 deletion eng/tox/allowed_pylint_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@
"azure-messaging-nspkg",
"azure-agrifood-farming",
"azure-ai-language-questionanswering",
"azure-ai-language-conversations"
"azure-ai-language-conversations",
"azure-developer-loadtesting"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 1.0.0b1 (2022-07-28)

- Initial version
21 changes: 21 additions & 0 deletions sdk/loadtestservice/azure-developer-loadtesting/LICENSE
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.
7 changes: 7 additions & 0 deletions sdk/loadtestservice/azure-developer-loadtesting/MANIFEST.in
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 sdk/loadtestservice/azure-developer-loadtesting/README.md
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 [email protected] 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/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
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()
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)
Loading